Ai Whatsapp Support With Human Handoff Using Gemini, Twilio, And Supabase Rag 11648 – n8n Workflows – Free Template

⬇️ Download workflow.json
Archivo detectado: wf-11648.json

What This Workflow Does

This n8n workflow creates an intelligent WhatsApp support system that combines AI assistance with human agent capabilities. The system uses Google Gemini as the AI backbone, integrated with Twilio for WhatsApp messaging and Supabase for RAG (Retrieval-Augmented Generation) knowledge management. When customers message your business on WhatsApp, the AI agent automatically responds to inquiries, but seamlessly hands off to human agents when needed. The workflow intelligently manages the conversation context and automatically resumes AI support if no human response occurs within a 2-hour window.

How It Works

The workflow operates through several interconnected processes:

  • Incoming WhatsApp messages trigger the Twilio node, initiating the support flow
  • The AI agent analyzes customer queries using Google Gemini with access to a vector database stored in Supabase
  • Documents are processed through a RAG pipeline that includes data loading, recursive character text splitting, and OpenAI embeddings for semantic search
  • When a human agent takes over a conversation, the AI system automatically steps back and stops responding
  • After 2 hours of no human response, the AI agent automatically resumes handling the conversation
  • The system maintains conversation memory using a buffer window to ensure context awareness across multiple exchanges
  • Human agents can use Airtable integration to manage cases and track conversation history

Use Cases

  • E-Commerce Customer Support: Handle product inquiries, order status updates, and returns through WhatsApp with AI-powered responses backed by product documentation
  • SaaS Technical Support: Provide first-line technical support to users, answer FAQ about features and integrations, with human escalation for complex issues
  • Real Estate Agent Coordination: Manage property inquiries and schedule viewings automatically, then hand off to agents for serious leads
  • Healthcare Appointment Management: Allow patients to inquire about services and schedule appointments via WhatsApp, with doctor availability managed by staff
  • Educational Institution Support: Answer student and parent questions about programs, admissions, and campus information with escalation to admissions counselors

Nodes Used

  • Twilio: Sends WhatsApp messages to customers
  • Twilio Trigger: Receives incoming WhatsApp messages
  • Google Drive Trigger: Monitors for new documents to add to knowledge base
  • Google Drive: Retrieves documents for knowledge base processing
  • Vector Store Supabase: Stores and retrieves embeddings from Supabase
  • Document Default Data Loader: Loads documents for processing
  • Text Splitter Recursive Character: Splits documents into optimal chunk sizes
  • Embeddings OpenAI: Generates vector embeddings (with 1536 dimension setting)
  • Agent: Orchestrates the AI conversation flow and decision-making
  • LM Chat Google Gemini: Provides AI responses using Google’s Gemini model
  • Memory Buffer Window: Maintains conversation context across exchanges
  • Tool Think: Enables the agent to reason through responses
  • Tool Calculator: Performs calculations when needed in responses
  • Airtable Tool: Integrates case management and conversation tracking
  • HTTP Request: Makes API calls for external integrations
  • Set: Sets and manages workflow variables
  • Filter: Routes messages based on conditions
  • If: Implements conditional logic for handoff decisions
  • Split in Batches: Processes data in manageable chunks
  • Sticky Note: Provides workflow documentation and notes
  • Supabase: Database operations for storing conversation history and user data

Prerequisites

  • Active Twilio account with WhatsApp Business Account configured
  • Google Gemini API access (via Google Cloud project)
  • OpenAI API account for embeddings generation
  • Supabase project with vector database capability enabled
  • Google Drive access for document storage and retrieval
  • Airtable workspace for case management (optional but recommended)
  • Documents or knowledge base files ready to upload to Google Drive
  • n8n instance with community or higher tier access
  • Proper webhook configuration for receiving Twilio messages

Difficulty Level

Advanced. This workflow requires experience with multiple API integrations, understanding of RAG (Retrieval-Augmented Generation) systems, and knowledge of vector embeddings. Users should be comfortable configuring Twilio webhooks, managing Supabase vector databases, and setting up multi-step conditional logic. The 2-hour timeout logic and AI/human handoff management add complexity. Recommended for users with intermediate to advanced n8n experience.

This workflow template is shared under the n8n fair-code license. Free to use and modify.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *