beginner

AI FAQ chatbot for n8n with email handoff

An n8n chatbot that answers visitor questions from your own FAQ text using OpenAI, and emails your team when it cannot answer. No CRM needed.

ChatbotAI agentSupport

Prerequisites

  • An n8n instance, cloud or self-hosted
  • An OpenAI API key (or another chat model credential)
  • Your FAQ or services copy as plain text; a few hundred words is enough to start
  • SMTP credentials in n8n for the Send Email node
  • An email address to receive contact requests

A chat widget that answers visitor questions from your own FAQ or services text, using an AI model instead of a fixed menu. If it cannot answer, or the visitor wants a person, it takes their email and passes it to your team.

What you'll build

A bot that answers only from the text you give it. If the question is outside that text, or the visitor asks to be contacted, it offers to take an email address and send it to you with a short summary, instead of leaving them stuck.

This is deliberately the plainest AI recipe: no consent step, no tags, no CRM. Every other chatbot recipe here is this one plus a specific integration.

How it works

  • A webhook receives each widget message and checks a shared secret.
  • An AI agent answers from the knowledge text in Chatbot settings and remembers the conversation by session.
  • When it cannot answer, it asks for an email address and calls the request_contact tool.
  • The tool is a separate workflow. It validates the email and sends your team a message through the Send Email node. If the send fails, it tells the agent so, and the agent says so honestly instead of claiming success.

What it costs

The workflow is free to download and use. Your AI provider charges per conversation, and your n8n hosting and the plan for the service you connect apply as normal. For N8N Chat UI plans, see pricing.

Set it up

  1. Import the workflow. Download the file with the button at the top of this page and import it with Workflows → Import from File. It holds the main chatbot and its tool workflow on one canvas, each in a labelled section.
  2. Move each tool into its own workflow. n8n tools call a separate workflow, so for each tool section below the main flow: select its nodes, copy them, create a new empty workflow and paste. Save it, then open the matching tool node under the agent and select that workflow.
  3. Fill in Chatbot settings. Set company_name and paste your FAQ text into knowledge.
  4. Choose a secret. Put a random string in webhook_secret in Chatbot settings. Your widget sends it so nobody else can call your workflow and run up your AI bill. It is a deterrent, not strong security: anything sent from a browser can be read.
  5. Add your AI credential. Open GPT-4.1 mini model and add your OpenAI credential. Swap the node for another chat model if you prefer.
  6. Set the handoff address. In the request contact section, open Tool settings and set handoff_email. If you skip this, requests go to the placeholder [email protected] and nobody notices, because the bot still tells the visitor it worked.
  7. Add SMTP. Attach your SMTP credential to the Email the visitor details to your team node.

Test it

Send a test message before you connect a widget. n8n's built-in chat panel needs a Chat Trigger, so it will not open for this workflow. Instead, click Test workflow, then send a POST request to the Test URL shown on the Chat webhook node:

curl -X POST 'YOUR_TEST_URL' \
  -H 'Content-Type: application/json' \
  -d '{"chatInput":"Hello","sessionId":"test-1","metadata":{"webhook_secret":"YOUR_SECRET"}}'

The test URL listens for one request each time you click Test workflow. For a longer conversation, activate the workflow and send requests to the production URL, then read each run under Executions. Reuse the same sessionId to continue a conversation, because memory is kept per session.

Things to try:

  • Ask something your knowledge text covers. It should answer directly.
  • Ask something it does not cover. It should offer to take an email and pass the question on, not just say it does not know.
  • Give an email address. Your team should receive a message with the summary.
  • Give a broken email address. The bot should ask you to confirm it.

Add it to your site

Activate the workflow and use its production webhook URL as your widget's chat endpoint. Send the same secret in the widget metadata, for example metadata: { page_url: window.location.href, webhook_secret: 'YOUR_SECRET' }. The metadata docs explain how metadata reaches n8n.

Any chat front end that can POST chatInput, sessionId and metadata to a webhook and read { "output": "..." } back will work. N8N Chat UI is built for exactly this.

Troubleshooting

The bot answers things that are not in my knowledge text

Check that the system prompt's instruction to answer only from knowledge is intact, if you have edited it.

Contact requests are not arriving

Check three things in order: the request_contact tool node is linked to its workflow, the SMTP credential is attached to the email node, and handoff_email is not still the placeholder.

My conversations reset when n8n restarts

Memory is an in-memory buffer so the template works as soon as you import it. A restart or redeploy drops conversations in progress. Before a busy launch, swap Conversation memory for Postgres Chat Memory. Nothing else changes.

I get a 401 as soon as I test

The Request from your widget? check compares metadata.webhook_secret in the request with webhook_secret in Chatbot settings. If they differ, or the request has no metadata, the workflow returns a 401 before the agent runs.

Take it further

Once a visitor is worth capturing as a proper lead rather than an email forward, swap the request contact tool for a lead capture tool from the HubSpot or ActiveCampaign recipes. If your FAQ outgrows a pasted block of text, use the Supabase knowledge base chatbot.