Build Your Own AI Chatbot in N8N: Complete Guide with Free JSON Template

Introduction

Ever wanted to create a smart chatbot that remembers conversations and automatically saves all chat data? Today, we’re sharing a powerful N8N automation workflow that does exactly that – and the best part? You can get it completely free!

At SeekheIndia, we believe in making automation accessible to everyone. That’s why we’re providing this complete chatbot workflow JSON that you can import directly into your N8N instance.

What This Chatbot Workflow Does

This isn’t just another basic chatbot. Here’s what makes it special:

Smart AI Responses – Powered by OpenAI GPT-3.5/GPT-4
Conversation Memory – Remembers last 10 messages for context
Automatic Data Logging – Saves every conversation to Google Sheets
Email Integration – Can send emails through Gmail
Session Management – Tracks individual user sessions
Tool Integration – AI can access Google Sheets data when needed

How to Set Up This Chatbot (Step-by-Step)

Step 1: Get the JSON Template

First, you’ll need the workflow JSON file. We’ve prepared a clean template with all sensitive IDs removed for your security.

Step 2: Import into N8N

  1. Open your N8N dashboard
  2. Create a new workflow
  3. Press Ctrl+V (or Cmd+V on Mac) to paste the JSON
  4. The workflow will automatically appear

Step 3: Configure Your Credentials

For OpenAI:

  • Click on “OpenAI Chat Model” node
  • Add your OpenAI API key
  • Choose between GPT-3.5-turbo (cheaper) or GPT-4 (smarter)

For Google Sheets:

  • Click on “Log to Google Sheets” node
  • Connect your Google account via OAuth2
  • Grant necessary permissions

Step 4: Create Your Google Sheet

Create a new Google Sheet with these column headers:

  • timestamp – When the message was sent
  • session_id – Unique user identifier
  • user_message – What the user asked
  • ai_response – What the AI replied

Copy your Sheet ID from the URL and update it in the workflow.

Step 5: Activate and Test

  1. Save your workflow
  2. Toggle the “Active” switch
  3. Copy your webhook URL
  4. Send a test message to verify everything works

Key Features Explained

🧠 AI Agent with Memory

The workflow uses an AI Agent node that maintains conversation context. It remembers the last 10 messages, making conversations feel natural and continuous.

📊 Google Sheets Integration

Every conversation is automatically logged with timestamps. This helps you:

  • Track user interactions
  • Analyze common questions
  • Improve your bot over time
  • Generate usage reports

📧 Gmail Tool Integration

The AI can send emails when needed. Perfect for:

  • Sending summaries
  • Forwarding important queries
  • Automated notifications

Get Your Free JSON Template

Leave a Reply

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