Starbase / 01 PlainAgent

PlainAgent / How to build an AI chatbot

Guide · Chatbots

How to build an AI chatbot

Pick one job, collect 30 to 50 real questions, give the bot only the documents that answer them, add a way to reach a person, and read every conversation in the first week. When a chatbot gives wrong answers, the cause is usually the knowledge behind it, not the model, and one check tells you which.

1. Decide what the chatbot is for

Pick one: answering customer questions, booking calls, helping staff find internal information, or guiding visitors to the right page. One chatbot, one purpose. A support bot that also tries to sell usually does both badly.

2. Collect the real questions

Pull 30 to 50 real questions from your inbox, tickets, chat logs or sales calls. These become your test set and show you which documents you need.

3. Prepare the knowledge

A chatbot can only be as good as the content behind it. Check that your docs actually answer the real questions. Remove outdated pages: old prices in a forgotten PDF will end up in answers. Short, clearly written facts work better than long marketing pages. If the bot will answer from a handbook or a folder of PDFs, the document Q&A agent template shows how to keep answers tied to those files.

4. Pick a builder

  • Inside an AI app: Custom GPTs (ChatGPT) or Claude Projects, for internal use or sharing a link.
  • On your website: chatbot platforms such as Voiceflow, Botpress, Intercom Fin or Tidio, which give you a widget and handoff.
  • Inside Microsoft 365: Copilot Studio.
  • Custom: an LLM API with retrieval (RAG) if you write code.

Features and prices change often; check each vendor's current pricing page.

Building it in n8n: one setting and one number to check first

If you want the chatbot inside your own automations, n8n is a common choice. In our study of 13,574 public n8n templates (snapshot Oct 20, 2026), 1,640 (12.1%) sit in the AI Chatbot category, and 1,574 of the 7,487 workflows with an AI step (21.0%) start from a chat message: n8n's own chat window in 772, Telegram in 652, WhatsApp in 140.

The n8n shape is a Chat Trigger node connected to an AI Agent node, with your docs attached as the knowledge. Two things from the Chat Trigger docs (checked Oct 26, 2026) matter before you go live. Authentication can be None, meaning anyone with the link can chat, so pick Basic Auth or n8n User Auth for an internal bot. And every message runs the workflow once, so a 10-message conversation uses 10 executions. On n8n Cloud Starter's 2,500 executions a month, that's about 250 such conversations. Our sister site breaks the plans down in n8n pricing explained, and has ready-made workflows in its n8n templates library.

5. Write the instructions

Tell it who it serves, to answer only from the knowledge, how long answers should be, and exactly when to hand off. Start from the support chatbot template or the FAQ chatbot template.

6. Set up the handoff

Decide where conversations go when the bot can't help: a ticket, an email, a live agent. Make "talk to a person" always work.

7. Test, launch small, read transcripts

Run every real question. Launch on one page, read all conversations for a week, fix the docs where answers were wrong, then widen.

When it makes things up: the check that tells you why

This is the question builders keep asking. Thread titles include "AI Agent in n8n hallucinating despite pinecone vector store setup – any fixes?" on r/n8n and "We deployed a support AI agent and it's hallucinating turns out the problem was not the AI it was our knowledge base" on r/CustomerSuccess. The beginner tutorials that rank for this search focus on wiring up the model and skip what to do when answers go wrong. Run this check on every wrong answer:

  1. Look at what the bot retrieved for that question. In n8n, open the execution and read the output of the document search step.
  2. If the right passage wasn't retrieved, the problem is the knowledge: the answer is missing, buried in a long page, or contradicted by an old one. Fix the document.
  3. If the right passage was retrieved and the answer still went wrong, the problem is the instructions. Tighten "answer only from the provided text" and say exactly what to do when the text doesn't cover the question.
  4. If nothing was retrieved because the bot never searched, it answered from memory or general knowledge. Make the document search a required step instead of an optional tool.

One more trap: chat memory is not knowledge. In n8n's "Support Chatbot" category in our study of 13,574 public n8n templates, 294 of 629 templates (46.7%) attach chat memory but only 106 (16.9%) search a document store. A bot with memory and no document search sounds consistent and still invents your refund policy.

Common mistakes

  • No handoff, so customers get stuck in loops.
  • Letting it answer from general knowledge, so it invents policies.
  • Launching everywhere at once without reading transcripts.

Ready-made support workflows for n8n are on RecipeAgents. See also chatbot examples, and AI agent examples for jobs that don't need a chat window.

Sponsor slot · availableFeature your product here
Newsletter

One agent template a week

A short Friday email: one agent spec, the system prompt, and what to test before you switch it on. Free, and the unsubscribe link is in every email.