Build an AI Chatbot with n8n: Step-by-Step Guide

Follow this step-by-step guide to build an AI Chatbot using n8n, based on the webinar.

✅ Prerequisites

  • An n8n account (cloud or self-hosted)
  • An OpenAI API key
  • Basic familiarity with drag-and-drop interfaces

🔧 Step 1: Create a New Workflow

  1. Log in to your n8n dashboard.
  2. Click “New Workflow”.
  3. Name your workflow (e.g., AI Chatbot).

🧲 Step 2: Add a Trigger Node

  1. Add a Trigger Node:
    • Choose “On Chat Message” if using n8n.cloud.
    • Alternatively, use Webhook or Manual Trigger for testing.

🤖 Step 3: Add the AI Agent Node

  1. Click “+” and search for “AI Agent”.
  2. Select “Chat Model”.
  3. Choose OpenAI as the provider.
  4. Click “Create New Credential” and enter:
    • API Key (from your OpenAI account)
    • Leave Organization ID and Base URL blank unless using a custom model.

🧠 Step 4: Configure the Chat Model

    1. Choose a model (e.g., gpt-4-1106-preview or gpt-4.0-mini).
    2. Optional: Set a System Message to define the chatbot’s personality or scope. Example:

You are a helpful assistant that only answers questions about tech entrepreneurship.

  1. Leave other parameters (temperature, max tokens) at default for now.

🔗 Step 5: Connect the Nodes

  1. Connect the Trigger Node to the AI Agent Node.
  2. Ensure the flow is linked properly (you should see arrows between nodes).

🧪 Step 6: Test the Chatbot

  1. Click “Execute Workflow” or “Test Step”.
  2. Type a message in the chat interface (e.g., “How do I start a tech business?”).
  3. The AI should respond based on your system prompt.

🌐 Step 7: Make It Public (Optional)

  1. Double-click the Chat Node.
  2. Enable “Make Chat Publicly Available”.
  3. Copy the public URL and share it with others.

🛠️ Troubleshooting Tips

  • If you get “No response,” ensure:
    • The nodes are connected.
    • The workflow is active.
    • The API key is valid.
  • Use the Execution Logs tab to debug.


@lerlerchan by LerLer Chan

lerlerchan



|


|


|


|


Ler Travel Diary is using
Web Hosting and n8n on Hostinger

To be a smart saver, check out
ShopBack for more information.

Enjoy SGD5 discount voucher on
Klook with code 53E7UD

Need discount for your travels? Check out our travel deals page.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *