/00 — boot sequence

Hello.

Article

Create Chat Bot in N8N

December 9, 2025•3 min read
N8N

Building an AI chatbot used to require complex code and expensive infrastructure. Today, you can build a powerful, context-aware AI agent in minutes using n8n—a workflow automation tool that connects your favorite apps with the latest AI models.

In this guide, we will walk through how to create a "Smart Assistant" that can chat with you, remember your conversation history, and even answer questions based on your specific needs.

What You’ll Need

Before we dive in, make sure you have the following:

  • n8n Installed: You can use the n8n Cloud version (easiest) or self-host it.

  • An API Key: We will use OpenAI (GPT-4o or GPT-3.5) for this tutorial, but n8n supports Anthropic (Claude), Mistral, and many others.


Step 1: Set Up the Trigger

Every automation needs a starting point. For a chatbot, this is the "Chat Trigger."

  1. Open a new workflow in n8n.

  2. Click the + button to add a node and search for "Chat Trigger".

  3. Select "When chat message received".

This node provides a ready-made chat interface inside n8n, so you don't need to build a frontend website to test your bot.


Step 2: Add the "Brain" (The AI Agent)

The core of your bot is the AI Agent node. This node manages the conversation, decides when to call tools, and formulates responses.

  1. Click the + connector on your Chat Trigger node.

  2. Search for "AI Agent" and select it.

  3. In the node settings, you will see inputs for Model, Memory, and Tools.

Pro Tip: In the AI Agent settings, you can customize the "System Message." This is where you give your bot a personality. For example: "You are a helpful technical support assistant who speaks in pirate slang."


Step 3: Give It Intelligence (Connect a Model)

The Agent needs a Large Language Model (LLM) to generate text.

  1. On the AI Agent node, find the Model input.

  2. Drag a connection from the "Model" input dot and release it to open the node search.

  3. Search for "OpenAI Chat Model" (or your preferred provider).

  4. Double-click the OpenAI node to configure it:

    • Credential: Create a new credential and paste your OpenAI API Key.

    • Model: Select gpt-4o-mini or gpt-3.5-turbo for a fast, cost-effective bot.


Step 4: Give It Context (Add Memory)

If you don't add memory, your bot will have amnesia—it won't remember what you said 10 seconds ago.

  1. Back on the AI Agent node, find the Memory input.

  2. Drag a connection and search for "Window Buffer Memory".

  3. Configuration:

    • Leave the defaults. This node will automatically store the last 5-10 messages of the conversation so the AI can reference them.

Step 5: Test Your Bot

Now that your brain, model, and memory are connected:

  1. Click "Chat" at the bottom of the screen (or the "Open Chat" button in the Chat Trigger node).

  2. Type "Hello!"

  3. Your bot should respond.

  4. Type "What is my name?" (It won't know).

  5. Type "My name is Ayaan."

  6. Type "What is my name?" again. If it answers "Ayaan," congratulations! You have a working memory-enabled AI bot.


Going Further: Adding Tools

The real power of n8n comes when you add Tools. You can give your AI agent the ability to:

  • Search the web: Connect a SerpAPI or Wikipedia tool.

  • Get current data: Connect a Weather tool or Calculator.

  • Access your files: Connect a Vector Store (like Pinecone or Qdrant) to let the AI read your PDFs and Notion docs (this is called RAG).

To do this, simply drag a connection from the Tools input on the AI Agent node and select the tool you want.

Conclusion

You have successfully built a functional AI chatbot without writing a single line of code. From here, you can expand your bot to handle customer support tickets, summarize emails, or manage your calendar—all within the same visual editor.

Happy building!


Build AI Agent with n8n

Resources & Links