Documentation Expert Chatbot with RAG and Gemini - n8n Workflow

Build a custom RAG chatbot using an n8n workflow, Gemini, and Supabase. Index n8n documentation to create an AI expert that answers questions about any n8n node or feature accurately.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

n8n developers and power users needing instant, factual documentation answers.
Engineers wanting hands-on experience building an enterprise-grade RAG solution.
Users looking for advanced n8n templates integrating AI agents and vector databases.
Teams requiring a reliable, knowledge-base-backed AI expert for their specific tools.

Overview

This sophisticated n8n workflow demonstrates the power of Retrieval-Augmented Generation (RAG) by turning the entire n8n documentation website into a specialized knowledge base. It solves the common Large Language Model problem of 'hallucination' by ensuring the AI's answers are strictly derived from the official documentation. The full n8n workflow is divided into two parts: an indexing flow that scrapes, processes, and stores knowledge chunks in a Supabase vector database, and a live chatbot flow, initiated by an n8n trigger, which retrieves relevant context to answer user queries using the Gemini LLM. This is one of the most powerful n8n templates available for creating accurate, domain-specific AI experts.

How it Works

The n8n workflow operates in two distinct phases:

Phase 1: Indexing (Knowledge Base Creation)


  1. Initiation: The process starts with the manual "Start Indexing" n8n trigger. It scrapes the main n8n documentation page.

  2. Link Extraction and Cleaning: Core n8n nodes (HTML, Remove Duplicates, Filter) extract, clean, and deduplicate all documentation links, preparing a comprehensive list of pages.

  3. Memory-Efficient Loop: An Execute Workflow n8n node initiates a sub-workflow loop, processing pages in batches for superior memory management, a key feature when indexing massive datasets like the full n8n documentation.

  4. Content Processing: Inside the loop, each page is scraped (HTTP Request), cleaned (HTML, Set), and checked against a long-term memory cache (Remove Duplicates) to avoid re-indexing.

  5. Vector Creation: A Recursive Character Text Splitter node breaks the clean text into small, overlapping chunks. The Gemini Chunk Embedding n8n node converts these chunks into numerical vectors (embeddings).

  6. Storage: The Your Supabase Vector Store n8n node inserts these vectors and their corresponding text chunks into the configured Supabase database, completing the knowledge base.

Phase 2: Live Chatbot (RAG)


  1. Activation: The live chat is started by the "RAG Chatbot" n8n trigger, which provides a public URL interface for user questions.

  2. Agent Orchestration: The user input feeds into the n8n Docs AI Agent n8n node, which maintains conversation history using the Simple Memory n8n node.

  3. Retrieval: The Agent identifies the need for information and uses the "Official n8n Documentation" Vector Store tool. The Gemini Query Embedding n8n node converts the user's question into a vector.

  4. Context Retrieval: The Vector Store searches Supabase for the top 10 documentation chunks most similar to the user's question vector.

  5. Synthesis: The Agent, powered by the Gemini 2.5 Flash n8n node, synthesizes a final, authoritative answer based only on the retrieved context, ensuring the answer is factually correct and specific to the requested n8n node or n8n workflow feature.

Installation Guide

To use this powerful n8n workflow template, you must configure Supabase and Google AI credentials.

1. Supabase Setup (Vector Database)


  1. Create Project: Sign up for Supabase and create a new project.

  2. Run SQL: Navigate to the SQL Editor in your Supabase project. Copy the SQL code found in the large "Sticky Note" node on the n8n canvas (it creates the vector extension, the documents table, and the search function).

  3. Credentials: Get your Project URL and the service_role API key from Project Settings > API.

  4. Connect in n8n: Select the Your Supabase Vector Store n8n node. Create a new Supabase credential, pasting the Project URL into Host and the Service Role Key into API Key.

2. Google AI Setup (Gemini)


  1. Obtain an API key for the Gemini model from Google AI Studio.

  2. Connect in n8n: Select the Gemini 2.5 Flash n8n node. Create a new Google AI credential and paste your Gemini API key.

3. Apply Credentials to Remaining Nodes

Select your new Supabase credential for the Official n8n Documentation and Keep Supabase Instance Alive n8n nodes.
Select your new Google AI credential for the Gemini Chunk Embedding and Gemini Query Embedding n8n nodes.

4. Run Indexing


  1. Locate the Start Indexing n8n trigger (top left).

  2. Click Execute workflow and wait approximately 15-20 minutes for the entire n8n documentation to be indexed. Do not proceed until this step completes.

5. Activate Chatbot


  1. Activate the entire n8n workflow using the main toggle switch.

  2. Open the RAG Chatbot n8n trigger node to access the Public URL and begin chatting with your n8n expert.

Node Details

RAG Chatbot (Chat Trigger): The entry point and public interface for the chatbot. It is a live n8n trigger that initiates the RAG process upon receiving a message.
n8n Docs AI Agent (Agent): The control hub. It uses its custom system prompt to enforce expert behavior and decide when to use the retrieval tool (the vector store) before formulating the final response via the LLM.
Gemini 2.5 Flash (LLM): The generative AI model providing reasoning and final text generation based on the context retrieved by the vector store.
Official n8n Documentation (Vector Store - Retrieve): Configured to retrieve 10 relevant document chunks from the Supabase database using the vector generated by the Gemini Query Embedding n8n node.
Your Supabase Vector Store (Vector Store - Insert): Handles batch insertion of documentation chunks and their corresponding embeddings into the Supabase table during the initial indexing run.
Remove Duplicate Documentation Content (Remove Duplicates): Uses the Remove items seen in previous executions operation, a powerful setting that provides long-term memory for the n8n workflow, ensuring documentation pages are only indexed once, even if the workflow is run multiple times.


  • Recursive Character Text Splitter (Text Splitter): Essential for RAG quality, it splits the long n8n documentation pages into smaller, contextually relevant chunks (1500 characters with 200 character overlap) for accurate embedding.

Related n8n Workflows

Free

Nodes: 21 Nodes
Updated: December 26 2025
View all
Created by

Innovative builder with a passion for crafting automation solutions that solve real-world challenges. From streamlining workflows to driving efficiency, my work empowers teams and individuals to achieve more with less effort. Experienced in developing scalable tools and strategies that deliver results with n8n, supabase and cline.

Featured*