n8n Documentation: Expert Chatbot with OpenAI RAG Pipeline
# How It Works This template is a complete, hands-on tutorial for building a **RAG (Retrieval-Augmented Generation)** pipeline. In simple terms, you'll teach an AI to become an expert on a specific topic—in this case, the official **n8n documentation**—and then build a chatbot to ask it questions. Think of it like this: instead of a general-knowledge AI, you're building an **expert librarian**. --- ## Workflow Overview The workflow is split into two main parts: ### Part 1: Indexing the Knowledge (Building the Library) This is a **one-time process** you run manually. The workflow will: - Automatically scrape all pages of the **n8n documentation**. - Break them down into small, digestible chunks. - Use an AI model to create a numerical representation (an **embedding**) for each chunk. - Store these embeddings in **n8n's built-in Simple Vector Store**. > This is like a librarian reading every book and creating a hyper-detailed index card for every paragraph. > **Important:** This in-memory knowledge base is **temporary**. It will be erased if you restart your n8n instance. You'll need to run the indexing process again in that case. --- ### Part 2: The AI Agent (The Expert Librarian) This is the **chat interface**. When you ask a question: 1. The AI agent **doesn't guess** the answer. 2. It searches the knowledge base to find the most relevant "index cards" (chunks). 3. It feeds those chunks to a language model (**Gemini**) with strict instructions: > "Answer the user's question using ONLY this information." This ensures answers are accurate, factual, and grounded in your documents. --- ## Setup Steps > **Total setup time**: ~2 minutes > **Indexing time**: ~15-20 minutes This template uses **n8n's built-in tools**, so no external database is needed. ### 1. Configure OpenAI Credentials - You'll need an **OpenAI API key** (for GPT models). - In your n8n workflow: - Go to any of the three OpenAI nodes (e.g., `OpenAI Chat Model`). - Click the **Credential** dropdown → `+ Create New Credential`. - Enter your OpenAI API key and **save**. ### 2. Apply Credentials to All Nodes - Your new credential is now saved. - Go to the other two OpenAI nodes (e.g., `OpenAI Embeddings`) and select the newly created credential from the dropdown. ### 3. Build the Knowledge Base - Find the **Start Indexing** manual trigger node (top-left of the workflow). - Click the **Execute Workflow** button to start indexing. > **Be patient**: This takes 15-20 minutes to scrape and process the full documentation. > You only need to do this **once per n8n session**. ### 4. Chat With Your Expert Agent - After indexing completes, **activate** the entire workflow (toggle at the top). - Open the **RAG Chatbot** chat trigger node (bottom-left). - Copy its **Public URL**. - Open it in a new tab and ask questions about n8n! Example questions: - How does the IF node work? - What is a sub-workflow? --- ## Credits All credits go to **Lucas Peyrin** — [lucaspeyrin on n8n.io](https://n8n.io/creators/lucaspeyrin/)
How It Works
This template is a complete, hands-on tutorial for building a RAG (Retrieval-Augmented Generation) pipeline. In simple terms, you'll teach an AI to become an expert on a specific topic—in this case, the official n8n documentation—and then build a chatbot to ask it questions.
Think of it like this: instead of a general-knowledge AI, you're building an expert librarian.
Workflow Overview
The workflow is split into two main parts:
Part 1: Indexing the Knowledge (Building the Library)
This is a one-time process you run manually. The workflow will:
- Automatically scrape all pages of the n8n documentation.
- Break them down into small, digestible chunks.
- Use an AI model to create a numerical representation (an embedding) for each chunk.
- Store these embeddings in n8n's built-in Simple Vector Store.
This is like a librarian reading every book and creating a hyper-detailed index card for every paragraph.
Important: This in-memory knowledge base is temporary. It will be erased if you restart your n8n instance. You'll need to run the indexing process again in that case.
Part 2: The AI Agent (The Expert Librarian)
This is the chat interface.
When you ask a question:
- The AI agent doesn't guess the answer.
- It searches the knowledge base to find the most relevant "index cards" (chunks).
- It feeds those chunks to a language model (Gemini) with strict instructions: > "Answer the user's question using ONLY this information."
This ensures answers are accurate, factual, and grounded in your documents.
Setup Steps
Total setup time: ~2 minutes
Indexing time: ~15-20 minutes
This template uses n8n's built-in tools, so no external database is needed.
1. Configure OpenAI Credentials
- You'll need an OpenAI API key (for GPT models).
- In your n8n workflow:
- Go to any of the three OpenAI nodes (e.g.,
OpenAI Chat Model). - Click the Credential dropdown →
+ Create New Credential. - Enter your OpenAI API key and save.
- Go to any of the three OpenAI nodes (e.g.,
2. Apply Credentials to All Nodes
- Your new credential is now saved.
- Go to the other two OpenAI nodes (e.g.,
OpenAI Embeddings) and select the newly created credential from the dropdown.
3. Build the Knowledge Base
- Find the Start Indexing manual trigger node (top-left of the workflow).
- Click the Execute Workflow button to start indexing.
Be patient: This takes 15-20 minutes to scrape and process the full documentation.
You only need to do this once per n8n session.
4. Chat With Your Expert Agent
- After indexing completes, activate the entire workflow (toggle at the top).
- Open the RAG Chatbot chat trigger node (bottom-left).
- Copy its Public URL.
- Open it in a new tab and ask questions about n8n!
Example questions:
- How does the IF node work?
- What is a sub-workflow?
Credits
All credits go to Lucas Peyrin — lucaspeyrin on n8n.io
New buyers can create an account from the cart to unlock a controlled $10 first-purchase credit on eligible orders of $25+.
Related bundle
Content Repurposing Engine
8 hand-picked workflows for $29.00.
That is $3.63 each, vs $24.99 for this one alone.
View bundleSecure checkout powered by Stripe
Support
How to import this workflow into n8n
- 1Purchase or download the workflow to get the n8n workflow JSON file.
- 2In your n8n instance, open Workflows and choose "Import from File" (or paste the JSON with Ctrl+V on the canvas).
- 3Open each node marked with a credential warning and connect your own accounts and API keys.
- 4Run the workflow once manually to verify the data flow, then toggle it to Active.
Related AI workflows
- Launch Your First AI-Powered Chatbot with Actionable Tools$9.99
- Automate AI Video Creation and YouTube Upload with Google Sheets$14.99
- Build a WhatsApp Assistant with Memory, Google Suite, Multi-AI, Research, and Imaging$24.99
- Automate Blog Post Creation and Publishing with GPT, Leonardo AI, and WordPress$14.99
- Automate SEO Keyword Generation with ChatGPT from Google Sheets$3.99
- Email Agent$500.99
Need this deployed? We'll set it up for you.
Our automation experts deploy this workflow in your stack, connect your accounts, and verify it works — or build a custom solution from scratch.