How to Build an AI Lead Qualification Chatbot in n8n
A lead qualification chatbot asks an inbound lead a few questions, works out whether they are a good fit, and hands the good ones to a person. In n8n you build it from a trigger, an AI agent, a memory node and a way to send the reply.
This guide names each part, says what n8n's documentation states about it, and explains the choices we made in our own template. The n8n pages were read on 25 September 2026. The design advice is our experience and is labeled as such.
The parts you need
n8n's AI Agent node lets you build an agent by connecting a chat model and one or more tools. The agent decides which tools to call to finish the task. The docs say you must connect at least one tool sub-node to the node, so plan a first tool, such as a calendar booking step or a CRM lookup, even for a bot that mostly asks questions.
| Part | n8n node | What the docs say |
|---|---|---|
| Receive the message | Webhook, or Chat Trigger | The Webhook node receives data from apps and services when an event occurs and can return the workflow result. It has separate test and production URLs. |
| Decide and reply | AI Agent (Tools Agent) | Connect a chat model and at least one tool. The agent picks which tool to call. |
| Remember the conversation | Simple Memory | Persists chat history. You set a session key and a context window length, the number of previous interactions to consider. |
| Return a fixed shape | Structured Output Parser | Returns fields based on a JSON Schema. Fields generated from an example are all mandatory. |
| Ask a person first | Human review on a tool | Pauses the workflow until someone approves or denies a tool call. |
Keep each lead in their own conversation
Memory needs a session key. The docs say the session ID normally comes from the Chat Trigger, and that if you are not using it you have to manage sessions manually. A static key is fine for testing, but n8n warns you to set up proper session management before you go live.
It also says that if a workflow has more than one Simple Memory node, they share one memory by default. For a bot that talks to many leads through a webhook, that is the mistake to avoid. If the key is not tied to the lead, one lead's answers can end up in another's context.
In our template the key is the contact ID from the inbound message, and the window is the last 12 turns. Our reasoning: a lead who replies tomorrow should pick up where they left off, and nobody else should see that thread.
Two limits of Simple Memory
The Simple Memory page says not to use the node if you run n8n in queue mode, because n8n cannot guarantee that every call goes to the same worker. The Tools Agent page also says memory does not persist between sessions.
If you run in queue mode, or need the history to survive a restart, look at the other memory nodes n8n lists, such as Redis Chat Memory and MongoDB Chat Memory, and check their pages for your setup. We have not tested them for this workflow.
Make the output predictable
The workflow needs more than the reply text. It needs to know whether the lead is qualified and whether to hand off. Our template tells the model to return JSON with a reply, a qualified flag and a handoff flag, then parses it in a Code node.
The Code node falls back to sending the raw text if parsing fails, and to a short holding message if the reply is empty, so a badly formed model answer never leaves a lead with silence. n8n offers a Structured Output Parser node that returns fields from a JSON Schema, which is another way to get the same shape. It does not support references in the schema.
Guardrails that matter
Our system prompt tells the agent to ask one question at a time, keep replies short, never invent pricing, availability or guarantees, and hand off when the lead asks for a person or sounds frustrated. In our experience that reduces bad answers. A prompt is an instruction, not enforcement, so treat it as the first layer rather than the only one.
For anything that acts on the outside world, n8n documents a human review step. It pauses the workflow before a chosen tool runs and waits for a person to approve or deny it. The docs give sending messages, modifying records and deleting data as examples of higher-risk tools, and suggest starting with review on and reducing it as confidence grows.
- Keep the bot to qualifying and booking. Route pricing, contracts and exceptions to a person.
- Put review on any tool that writes to your CRM or sends something the lead cannot unsee.
- Read a sample of real conversations every week for the first month.
Before you switch it on
- Publish the workflow and use the production webhook URL in your messaging provider. n8n registers the production URL on publishing and does not show its data in the editor, so use the Executions tab to inspect runs.
- Add an error workflow so a failed run alerts a person. Our enterprise workflow automation guide shows how n8n and Microsoft Power Automate handle this.
- Test with awkward inputs: a lead who gives no details, one who asks for pricing, one who is angry, one who writes in another language.
- Check the rules for the channel you send on. Texting in particular has consent and registration requirements that this guide does not cover.
The short answer
Build it from a webhook, an AI Agent node with at least one tool, memory keyed to each lead, and a reply step that still works when the model returns something odd. Add human review to anything that writes or sends.
The hard parts are not the model. They are keeping each lead's thread separate, deciding what the bot may never say, and making sure a failure reaches a person.
Common questions
Which n8n nodes do I need for a lead qualification chatbot?
A trigger such as Webhook or Chat Trigger, an AI Agent node with a chat model and at least one tool, a memory node such as Simple Memory, and a step that sends the reply. A Structured Output Parser or a Code node helps you get a predictable output.
How do I stop leads seeing each other's conversations?
Set the memory session key to a value unique to each lead, such as a contact ID. n8n says that without the Chat Trigger you must manage sessions manually, and that multiple Simple Memory nodes share one memory by default.
Can I use Simple Memory in production?
Not in queue mode, according to n8n's documentation. Its Tools Agent page also says memory does not persist between sessions. Check the other memory nodes for your setup.
How do I stop the bot making things up?
Use a strict system prompt as a first layer, keep the bot to narrow tasks, and add n8n's human review step on tools that send or change things. A prompt alone does not guarantee behavior.
Sources
Read on . Vendor terms change, so check the current page before you rely on a definition.