How to Build an AI Support Chatbot in n8n: RAG Knowledge Base, Memory, and Human Escalation
Introduction
Support teams answer the same questions every day: password resets, pricing plans, refund policies, setup steps. A rule-based FAQ bot deflects only the questions you anticipated, and every unexpected phrasing lands back in the human queue. This tutorial builds the next level in n8n: an AI support chatbot that searches your real support documents for each question, remembers the conversation, and escalates to a human with a summary when it genuinely cannot help. Every node name and parameter default below was verified against n8n 2.41.4’s own node definitions on a lab install.
Quick answer
Connect a Chat Trigger to an AI Agent with an OpenAI Chat Model, Simple Memory for history, and a Vector Store Retriever over your docs as a tool. Route replies containing ESCALATE_TO_HUMAN to your helpdesk.
Why support teams are building these now: the numbers
The shift is measurable. Gartner predicts that by 2027, chatbots will become the primary customer service channel for roughly a quarter of organizations, and its January-February 2022 customer service survey of 50 respondents found 54% already using some form of chatbot, virtual customer assistant, or conversational AI for customer-facing applications. The platform underneath this tutorial is growing with that demand: n8n measured 206,491 GitHub stars on October 2, 2026, queried directly from the GitHub API, making it one of the most-starred workflow automation projects in the world.
Two statements anchor the design. Gartner senior director analyst Uma Challa says: “When designed correctly, chatbots can improve customer experience and drive positive customer emotion at a lower cost than live interactions.” And n8n’s AI Agent documentation defines the core of this build: “The AI Agent node lets you build an AI agent in n8n. Connect a chat model and one or more tools, and the agent decides which tools to call to complete a task.” The retriever is one of those tools, and n8n’s Vector Store Retriever documentation describes how it fetches relevant chunks from your vector database on every question. For memory, n8n’s Simple Memory documentation warns: “Don’t use this node if running n8n in queue mode,” because n8n cannot guarantee every call reaches the same worker, which is why Step 7 covers the production memory swap.
Prerequisites
- n8n 1.82 or newer, self-hosted or cloud. Verified on n8n 2.41.4. If your instance is older, update first with our n8n self-hosted update runbook. New to self-hosting? See our n8n Docker Compose setup.
- An OpenAI API key with billing enabled, for the chat model and embeddings.
- A Qdrant instance: Qdrant Cloud’s free tier works, or run it locally with
docker run -p 6333:6333 qdrant/qdrant. - Your support content: help-center articles, FAQ pages, or a Google Doc export, as plain text or markdown files.
- About 45 minutes and basic n8n editor skills.
The architecture
Two workflows do the whole job. The ingestion workflow runs once (and again whenever docs change): it loads your support documents, splits them into chunks, embeds them, and stores them in Qdrant. The chat workflow runs per conversation: Chat Trigger to AI Agent, with OpenAI Chat Model, Simple Memory, and a Vector Store Retriever connected to Qdrant, plus an IF node that catches escalations. If you already built our n8n AI agent tutorial, the chat workflow will look familiar: same agent, new attachments.
Step 1: Build the knowledge base ingestion workflow
Create a workflow named support-docs-ingest. Add a Default Data Loader node and point it at your support documents. Then add the Recursive Character Text Splitter: its Chunk Size and Chunk Overlap parameters control how documents break apart, and the defaults are a sane starting point for help articles, one section per chunk. Attach Embeddings OpenAI and a Qdrant Vector Store node configured for insert, and run the workflow once. Open your Qdrant dashboard and confirm the collection shows a nonzero point count before moving on; an empty collection is the most common cause of a bot that “answers from nowhere,” covered in Troubleshooting. For the full parameter-by-parameter walkthrough of this ingestion pattern, see our n8n vector store tutorial and the deeper n8n LangChain RAG tutorial.
Step 2: Add a Chat Trigger in Hosted Chat mode
Create a second workflow named support-chatbot. Add the Chat Trigger node first. Open its settings and find the Mode option, which I verified in the 2.41.4 node source: choose Hosted Chat. n8n serves a chat page for you, no frontend code needed, and each visitor automatically gets their own session. That per-visitor session is what the memory node will key on in Step 4.
Step 3: Add the AI Agent and connect the chat model
Add the AI Agent node after the Chat Trigger and connect them. Attach the OpenAI Chat Model sub-node to the agent’s model connector, create the credential with your API key, and select gpt-4o-mini for support traffic: fast and cheap for grounded Q&A, swappable later without touching anything else.
Now write the agent prompt, the single most important text in this tutorial. The prompt goes in the AI Agent node’s prompt field; define it directly on the node:
You are a support agent for our product. Answer ONLY using the documents returned by the knowledge base tool. If the documents do not contain the answer, or the customer asks for a refund, cancellation, or account deletion, reply with exactly this on the first line: ESCALATE_TO_HUMAN, followed by a one-line summary of the request. Never invent prices, policies, or procedures. Keep answers under 120 words.
The marker phrase is the contract the escalation branch in Step 6 depends on. Be strict here: a bot that guesses refund policies is worse than no bot.
Step 4: Attach Simple Memory for conversation context
With the AI Agent selected, click the plus on its memory connector and add Simple Memory. Its description in the node source reads “Stores in n8n memory, so no credentials required”: history lives inside the running n8n process, nothing to configure. Two settings matter, both verified in 2.41.4:
- Session ID: leave it on Connected Chat Trigger Node. n8n scopes each chat session separately, so two customers never see each other’s history.
- Context Window Length: the default is 5, meaning five past exchanges (roughly ten message turns) are fed back to the model on every call. Enough for a natural support conversation without drowning the model in tokens.
This is the same memory setup from our n8n chatbot with memory tutorial, which covers session scoping and context tuning in depth.
Step 5: Connect the Vector Store Retriever as a tool
Still on the AI Agent, click the plus on its tools connector and add the Vector Store Retriever. This is what makes the bot a support bot instead of a generic chatbot: per the docs, the retriever queries your vector database on every question and hands the matching chunks to the agent. Connect two sub-nodes to the retriever:
- Embeddings OpenAI, with the same embedding model you used in the ingestion workflow. This is critical: insert and retrieve must use the same model, or the vectors will not match and every query will come back empty.
- Your Qdrant Vector Store node, pointed at the same collection from Step 1, with Limit set to 4 or 5 so the agent gets a handful of relevant chunks instead of one.
Name the tool clearly, for example support_knowledge_base, so the agent understands when to call it.
Step 6: Add the human escalation branch
Add an If node after the AI Agent. Set the condition to check whether the agent’s reply text contains ESCALATE_TO_HUMAN. On the true branch, add your handoff: a Slack message, an email via the Gmail node, or an HTTP call that creates a ticket in your helpdesk, including the customer’s question and the agent’s one-line summary. Strip the marker phrase from the customer-facing text so nobody sees the plumbing. On the false branch, connect back toward the chat output so normal answers flow to the customer.
Test the branch deliberately: ask the bot your refund policy question in the test chat and confirm a ticket appears in your helpdesk with the summary attached. An escalation path you have never triggered is not an escalation path.
Step 7: Harden memory for production
Simple Memory keeps history in the n8n process, which breaks in two production scenarios. First, restarting n8n wipes every conversation. Second, the node itself warns it is not compatible with queue mode or multi-main setups because calls may land on different workers. For a support bot that must survive restarts and scale, swap Simple Memory for Postgres Chat Memory or Redis Chat Memory before launch. The parameters are the same (Session ID, Context Window Length), the history just lives in a database instead of process memory. Our n8n Postgres tutorial covers the database setup you will point the memory node at. If you run n8n in Docker Compose, our setup guide already includes Postgres and Redis services you can point the memory node at.
Step 8: Test, activate, and share
Use the Chat Trigger’s test chat to run five realistic conversations: a pricing question, a how-to question, a follow-up that references an earlier message (“what about the annual plan you mentioned?”), a question your docs cannot answer, and a refund request. The first three should be answered from your docs, the fourth should produce a clean “I don’t have that documented” style reply, and the fifth must hit your escalation branch. When all five behave, activate the workflow and share the production chat URL from the Chat Trigger node. Embed it on your support page or link it from your help center header.
Troubleshooting
Bot answers confidently but the answer is not in your docs. The retriever is returning irrelevant chunks or nothing, and the agent is filling the gap. First check the Qdrant collection actually has points from Step 1. Then confirm the ingestion workflow and the retriever use the same Embeddings OpenAI model: mixed embedding models are the classic silent failure, because vectors from different models never match at query time. Finally, reduce chunk size in the Recursive Character Text Splitter so each chunk holds one idea.
OpenAI returns 429 or insufficient_quota. The real error reads: “You exceeded your current quota, please check your plan and billing details.” This is a billing problem, not a code problem: add payment details or raise limits in the OpenAI platform. While you wait, switch the agent to gpt-4o-mini if you were testing with a larger model; it costs a fraction per token and keeps the bot online.
Two customers see each other’s conversation history. Session ID is not scoped per visitor. Open Simple Memory and set Session ID back to Connected Chat Trigger Node. If you switched to “Define below” with a fixed key during testing, every chat shares one memory, which is exactly the bug. The node description in 2.41.4 spells this out: sessions are scoped to the memory node unless you define a shared key deliberately.
The production chat URL returns 404 but the test chat works. The workflow is not active. The test chat URL only works while you are building; visitors need the production URL, which only serves traffic after you flip the workflow to Active. Activate it, copy the production URL from the Chat Trigger node, and retest in an incognito window.
Memory works in testing but vanishes after every n8n restart. That is Simple Memory behaving as designed: it stores history in the n8n process. Move to Postgres Chat Memory or Redis Chat Memory per Step 7 before you call the bot production-ready.
FAQ
How is an AI support chatbot different from a regular FAQ bot?
An FAQ bot matches keywords to canned answers and fails on anything phrased unexpectedly. The n8n support bot in this tutorial is an AI Agent with a Vector Store Retriever: it searches your actual support documents for each question and generates an answer from what it finds, with Simple Memory keeping the conversation context.
Do I need a vector database, or can the agent just read my docs directly?
You need the vector database for anything beyond a few pages. The agent’s context window cannot hold a whole help center, so you embed documents into Qdrant once and the Vector Store Retriever fetches only the relevant chunks per question. We use Qdrant because its n8n node works with both cloud and self-hosted instances.
What happens when the bot cannot answer a question?
The agent is instructed to reply with the marker phrase ESCALATE_TO_HUMAN plus a one-line summary. An IF node checks the reply for that marker and routes the conversation to your helpdesk channel instead of returning a guess to the customer.
Can the chatbot remember what a customer said earlier in the conversation?
Yes. The Simple Memory sub-node stores the last five exchanges by default, scoped per chat session when Session ID is set to Connected Chat Trigger Node. Each visitor gets their own memory, verified against n8n 2.41.4’s node definitions.
How much does it cost to run per conversation?
Two OpenAI calls dominate the cost: one embedding call for the retriever and one chat completion for the answer. With gpt-4o-mini and the standard OpenAI embedding model, a typical support exchange costs a fraction of a cent. Memory adds tokens for the last five exchanges, which is why the default context window is small.
Can I connect this bot to Slack or a website instead of the hosted chat page?
Yes. Switch the Chat Trigger from Hosted Chat mode to webhook-based modes and connect Slack, Telegram, or your website’s chat widget to the production webhook URL. The agent, memory, retriever, and escalation logic stay identical; only the entry point changes.
Conclusion
You now have a support chatbot that answers from your own documentation, remembers the conversation, and knows when to hand off to a human. Swap the document set and the prompt, and the same two workflows become an IT helpdesk bot, a sales qualification bot, or an API docs assistant. Next, harden the pipeline that feeds it: our n8n LangChain RAG tutorial goes deeper on chunking strategies and retrieval quality, which is where grounded bots win or lose.
Frequently asked questions
How is an AI support chatbot different from a regular FAQ bot?
An FAQ bot matches keywords to canned answers and fails on anything phrased unexpectedly. The n8n support bot in this tutorial is an AI Agent with a Vector Store Retriever: it searches your actual support documents for each question and generates an answer from what it finds, with Simple Memory keeping the conversation context.
Do I need a vector database, or can the agent just read my docs directly?
You need the vector database for anything beyond a few pages. The agent's context window cannot hold a whole help center, so you embed documents into Qdrant once and the Vector Store Retriever fetches only the relevant chunks per question. We use Qdrant because its n8n node works with both cloud and self-hosted instances.
What happens when the bot cannot answer a question?
The agent is instructed to reply with the marker phrase ESCALATE_TO_HUMAN plus a one-line summary. An IF node checks the reply for that marker and routes the conversation to your helpdesk channel instead of returning a guess to the customer.
Can the chatbot remember what a customer said earlier in the conversation?
Yes. The Simple Memory sub-node stores the last five exchanges by default, scoped per chat session when Session ID is set to Connected Chat Trigger Node. Each visitor gets their own memory, verified against n8n 2.41.4's node definitions.
How much does it cost to run per conversation?
Two OpenAI calls dominate the cost: one embedding call for the retriever and one chat completion for the answer. With gpt-4o-mini and text-embedding-3-small, a typical support exchange costs a fraction of a cent. Memory adds tokens for the last five exchanges, which is why the default context window is small.
Can I connect this bot to Slack or a website instead of the hosted chat page?
Yes. Switch the Chat Trigger from Hosted Chat mode to webhook-based modes and connect Slack, Telegram, or your website's chat widget to the production webhook URL. The agent, memory, retriever, and escalation logic stay identical; only the entry point changes.