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:

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.

  1. 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.

  1. 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.

  1. 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

0
Downloads
183
Views
8.54
Quality Score
intermediate
Complexity
Author:Ayham Joumran(View Original →)
Created:8/13/2025
Updated:8/25/2025

🔒 Please log in to import templates to n8n and favorite templates

Workflow Visualization

Loading...

Preparing workflow renderer

Comments (0)

Login to post comments