Skip to main content

WhatsApp RAG chatbot with Supabase, Gemini 2.5 Flash, and OpenAI embeddings

Workflow preview

Workflow preview
100%
WhatsApp RAG chatbot with Supabase, Gemini 2.5 Flash, and OpenAI embeddings preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

WhatsApp RAG Chatbot with Supabase, Gemini 2.5 Flash, and OpenAI Embeddings This n8n template demonstrates how to build a WhatsApp based AI chatbot that answers user questions using document retrie...

Best for

  • Support Chatbot automation workflows
  • AI RAG automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

@n8n/n8n-nodes-langchain.vectorstoresupabase, n8n-nodes-base.whatsapptrigger, n8n-nodes-base.switch, @n8n/n8n-nodes-langchain.documentdefaultdataloader, @n8n/n8n-nodes-langchain.embeddingsopenai, @n8n/n8n-nodes-langchain.lmchatgooglegemini, @n8n/n8n-nodes-langchain.agent, n8n-nodes-base.whatsapp

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Manav Desai.

Original n8n.io source

1.1 Workflow description

Title
WhatsApp RAG chatbot with Supabase, Gemini 2.5 Flash, and OpenAI embeddings
Workflow name
WhatsApp RAG chatbot with Supabase, Gemini 2.5 Flash, and OpenAI embeddings

WhatsApp RAG Chatbot with Supabase, Gemini 2.5 Flash, and OpenAI Embeddings

This n8n template demonstrates how to build a WhatsApp-based AI chatbot that answers user questions using document retrieval (RAG) powered by Supabase for storage, OpenAI embeddings for semantic search, and Gemini 2.5 Flash LLM for generating high-quality responses.

Use cases are many: Turn your WhatsApp into a knowledge assistant for FAQs, customer support, or internal company documents — all without coding.


Good to know

  • The workflow uses OpenAI embeddings for both document embeddings and query embeddings, ensuring accurate semantic search.
  • Gemini 2.5 Flash LLM is used to generate user-friendly answers from the retrieved context.
  • Messages are processed in real-time and sent back directly to WhatsApp.
  • Workflow is modular — you can split document ingestion and query handling for large-scale setups.
  • Supabase and WhatsApp API credentials must be configured before running.

How it works

  1. Trigger: A new WhatsApp message triggers the workflow via webhook.
  2. Message Check: Determines if the message is a query or a document upload.
  3. Document Handling:
    • Fetch file URL from WhatsApp.
    • Convert binary to text.
    • Generate embeddings with OpenAI and store them in Supabase.
  4. Query Handling:
    • Generate query embeddings with OpenAI.
    • Retrieve relevant context from Supabase.
    • Pass context to Gemini 2.5 Flash LLM to compose a response.
  5. Response: Send the answer back to the user on WhatsApp.

Optional: Add Gmail node to forward chat logs or daily summaries.


How to use

  • Configure WhatsApp Business API webhook for incoming messages.
  • Add your Supabase and OpenAI credentials in n8n’s credentials manager.
  • Upload documents via WhatsApp to populate the Supabase vector store.
  • Ask queries — the bot retrieves context and answers using Gemini 2.5 Flash.

Requirements

  • WhatsApp Business API (or Twilio WhatsApp Sandbox)
  • Supabase account (vector storage for embeddings)
  • OpenAI API key (for generating embeddings)
  • Gemini API access (for LLM responses)

Customising this workflow

  • Swap WhatsApp with Telegram, Slack, or email for different chat channels.
  • Extend ingestion to other sources like Google Drive or Notion.
  • Adjust the number of retrieved documents or prompt style in Gemini for tone control.
  • Add a Gmail output node to send logs or alerts automatically.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Retrieve Context from Supabase

Type / Role
@n8n/n8n-nodes-langchain.vectorStoreSupabase - vectorStoreSupabase
Config choices
Version 1.3

Block 2 - New WhatsApp Message

Type / Role
n8n-nodes-base.whatsAppTrigger - whatsAppTrigger
Config choices
Version 1

Block 3 - Check if Query or Document

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.2

Block 4 - Convert File to Text

Type / Role
@n8n/n8n-nodes-langchain.documentDefaultDataLoader - documentDefaultDataLoader
Config choices
Version 1.1

Block 5 - Generate OpenAI Embeddings

Type / Role
@n8n/n8n-nodes-langchain.embeddingsOpenAi - embeddingsOpenAi
Config choices
Version 1.2

Block 6 - Store Embeddings in Supabase

Type / Role
@n8n/n8n-nodes-langchain.vectorStoreSupabase - vectorStoreSupabase
Config choices
Version 1.3

Block 7 - Google Gemini LLM

Type / Role
@n8n/n8n-nodes-langchain.lmChatGoogleGemini - lmChatGoogleGemini
Config choices
Version 1

Block 8 - RAG Query Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 2.1

Block 9 - Send WhatsApp Reply

Type / Role
n8n-nodes-base.whatsApp - whatsApp
Config choices
Version 1

Block 10 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 11 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 12 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 13 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 14 - Get Document URL

Type / Role
n8n-nodes-base.whatsApp - whatsApp
Config choices
Version 1

Block 15 - Download WhatsApp Document

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 16 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 17 - Sticky Note5

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow WhatsApp RAG chatbot with Supabase, Gemini 2.5 Flash, and OpenAI embeddings
Complexity advanced
Nodes 17
Categories Support Chatbot, AI RAG
Author Manav Desai
Published 01 Aug 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/6771/6771.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does WhatsApp RAG chatbot with Supabase, Gemini 2.5 Flash, and OpenAI embeddings do?

WhatsApp RAG Chatbot with Supabase, Gemini 2.5 Flash, and OpenAI Embeddings This n8n template demonstrates how to build a WhatsApp based AI chatbot that answers user questions using document retrie...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Support Chatbot, AI RAG use case.