This workflow corresponds to n8n.io template #6290 — we link there as the canonical source.
This workflow follows the Agent → Chat Trigger recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"id": "wnDz3dZ455lkg5la",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "Website Chatbot Agent",
"tags": [
{
"id": "VjxhWkY5mLmByR16",
"name": "Active",
"createdAt": "2025-06-19T23:49:38.399Z",
"updatedAt": "2025-06-19T23:49:55.312Z"
}
],
"nodes": [
{
"id": "564d5030-4338-433f-91aa-fb01b376f888",
"name": "When chat message received",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
60,
80
],
"parameters": {
"mode": "webhook",
"public": true,
"options": {}
},
"typeVersion": 1.1
},
{
"id": "c720eaaf-0fb0-402d-a9c1-c503bd4a919d",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
200,
460
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini",
"cachedResultName": "gpt-4o-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "b8992569-06c1-4ebb-8fbe-e3f5ea91c00b",
"name": "calendarAgent",
"type": "@n8n/n8n-nodes-langchain.toolWorkflow",
"position": [
1140,
500
],
"parameters": {
"name": "calendarAgent",
"workflowId": {
"__rl": true,
"mode": "list",
"value": "LpmYLHWdvevdwt5e",
"cachedResultName": "Calendar Agent"
},
"description": "Call this tool for any calendar action.",
"workflowInputs": {
"value": {},
"schema": [],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
}
},
"typeVersion": 2
},
{
"id": "e5f6d811-75ac-48ef-b891-a94732f01f01",
"name": "RAGagent",
"type": "@n8n/n8n-nodes-langchain.toolWorkflow",
"position": [
940,
580
],
"parameters": {
"name": "RAGagent",
"workflowId": {
"__rl": true,
"mode": "list",
"value": "IkEdDr98G9p54XDT",
"cachedResultName": "RAG Agent"
},
"description": "=Call this tool to get answers for FAQs regarding Kamexa. \nThe input should always be the question you want answered along with the following sessionId - {{ $('When chat message received').item.json.sessionId }}",
"workflowInputs": {
"value": {},
"schema": [],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
}
},
"typeVersion": 2
},
{
"id": "5a3275cb-0953-4ea5-ae23-557edd26f9d4",
"name": "ticketAgent",
"type": "@n8n/n8n-nodes-langchain.toolWorkflow",
"position": [
680,
620
],
"parameters": {
"name": "ticketAgent",
"workflowId": {
"__rl": true,
"mode": "list",
"value": "tMyGGwgRHFuqYKg3",
"cachedResultName": "Ticket Agent"
},
"description": "Call this tool to create a support ticket for a human agent to followup on via email. \n\nThe input should be the users name and email address and a snippet of the users request. ",
"workflowInputs": {
"value": {},
"schema": [],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
}
},
"typeVersion": 2
},
{
"id": "d2044a89-2823-4590-93b5-d4913b20c571",
"name": "Simple Memory",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
440,
540
],
"parameters": {
"contextWindowLength": 10
},
"typeVersion": 1.3
},
{
"id": "a80e06be-cbe1-42c0-a293-772859044956",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-700,
-360
],
"parameters": {
"width": 660,
"height": 1480,
"content": "# Website Chatbot Agent with Modular Sub-Agent Architecture\n\n#### Overview \nThis workflow implements a modular **Website AI Chatbot Assistant** capable of handling multiple types of customer interactions autonomously. Instead of relying on a single large agent to handle all logic and tools, this system routes user queries to specialized sub-agents\u2014each dedicated to a specific function.\n\n By using a manager-style orchestration layer, this approach prevents overloading a single AI model with excessive context, leading to cleaner routing, faster execution, and easier scaling as your automation needs grow.\n\n\n#### How It Works\n\n**1. Chat Trigger** \n- The flow is initiated when a chat message is received via the website widget.\n\n**2. Manager Agent (Ultimate Website AI Assistant)** \n- The central LLM-based agent is responsible for parsing the message and deciding which specialized sub-agent to route it to.\n- It uses an OpenAI GPT model for natural language understanding and a lightweight memory system to preserve recent context.\n\n**3. Sub-Agent Routing** \n- `calendarAgent`: Handles availability checks and books meetings on connected calendars. \n- `RAGAgent`: Searches company documentation or FAQs to provide accurate responses from your internal knowledge base. \n- `ticketAgent`: Forwards requests to human support by generating and sending support tickets to a designated email.\n\n---\n\n#### Setup Instructions\n\n1. **Embed the Chatbot** \n - Use a custom HTML widget or script to embed the chatbot interface on your website. \n - Connect the frontend to the webhook that triggers the `When chat message received` node.\n\n2. **Configure Your OpenAI Key** \n - Insert your API key in the `OpenAI Chat Model` node. \n - Adjust the model parameters for temperature, max tokens, etc., based on how formal or creative you want the bot to be.\n\n3. **Customize Sub-Agents** \n - `calendarAgent`: Connect to your Google or Outlook calendar. \n - `RAGAgent`: Link to a vector store or document database via API or native integration. \n - `ticketAgent`: Set the destination email and format for ticket generation (e.g. via SendGrid or SMTP).\n\n4. **Deploy in Production** \n - Host on n8n Cloud or your self-hosted instance. \n - Monitor usage through the Executions tab and refine prompts based on user behavior.\n\n---\n\n#### Benefits\n\n- Modular system with dedicated logic per function \n- Reduces token bloat by offloading complexity to sub-agents \n- Easy to scale by adding more tools (e.g. CRM, analytics) \n- Fast and responsive user experience for customers on your site \n- Cleaner code structure and easier debugging\n"
},
"typeVersion": 1
},
{
"id": "b74b0e7f-91c5-4b9f-97e3-1180c97a1c30",
"name": "Ultimate Website Chatbot Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
560,
80
],
"parameters": {
"options": {
"systemMessage": "=You are Dan Bot, the helpful, friendly chatbot assistant for Marketing Ladder, a marketing agency. You don\u2019t answer questions yourself, you send every request to the right tool. \n\nAvailable Tools\nRAGagent \u2013 Use to answer FAQs and anything about Marketing Ladder.\ncalendarAgent \u2013 Use to check availability and book consultations.\nticketAgent \u2013 Use when the user wants a human, you don\u2019t have enough info, or you can\u2019t complete the request.\n\n\nCore Capabilities\n1. Answer FAQs\nIf a user asks a question, immediately query the RAGagent.\nNever guess, improvise, or answer on your own.\nNo tool call = no answer.\n\n2. Book Consultations\nIf a user wants to book a consultation, collect the following information:\nFull name, Company Name, Email address, their goal for the consultation, preferred day and time (remember: Chicago timezone, 30-min meetings)\n\nProcess:\n-Check their preferred slot with calendarAgent.\n-If unavailable, offer the closest alternate available times on the same day. \n-Once they pick a slot, confirm all details (name, email, goal, time).\n-After confirmation, use calendarAgent to book and send them confirmation.\nGolden Rule: Never double book. Always check availability first.\n\n3. Escalate to a Human Agent if any of these happen:\n\n-RAGagent can\u2019t find an answer\n-User wants to talk to a human\n-You can\u2019t complete their request\n\nThen:\nAsk if they\u2019d like to be contacted by a human agent. If yes, collect:\nFirst name, Email address, Description of their issue or question\nThen, use ticketAgent to create a support ticket.\n\nRules of Engagement:\n-No improvisation. Tools only.\n-Always clarify if info is missing or unclear.\n-The current date is {{ $now.format('yyyy-MM-dd') }}. You are in the Chicago timezone. Always confirm this when talking about times.\n-Redirect trolls. If someone derails the convo away from Marketing Ladder, steer them back or offer to escalate to a human.\n-Have a friendly, conversational tone of voice, but stick to the point.\n-Default CTA: Always try to book them in for a consultation. That\u2019s your north star.\n"
}
},
"typeVersion": 1.7
}
],
"active": true,
"settings": {
"timezone": "America/Chicago",
"callerPolicy": "workflowsFromSameOwner",
"executionOrder": "v1"
},
"versionId": "daed30db-61fa-48ab-aaf8-d507dc609fc5",
"connections": {
"RAGagent": {
"ai_tool": [
[
{
"node": "Ultimate Website Chatbot Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"ticketAgent": {
"ai_tool": [
[
{
"node": "Ultimate Website Chatbot Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Simple Memory": {
"ai_memory": [
[
{
"node": "Ultimate Website Chatbot Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"calendarAgent": {
"ai_tool": [
[
{
"node": "Ultimate Website Chatbot Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "Ultimate Website Chatbot Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"When chat message received": {
"main": [
[
{
"node": "Ultimate Website Chatbot Agent",
"type": "main",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
openAiApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow implements a modular Website AI Chatbot Assistant capable of handling multiple types of customer interactions autonomously. Instead of relying on a single large agent to handle all logic and tools, this system routes user queries to specialized sub-agents—each…
Source: https://n8n.io/workflows/6290/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
This n8n template provides a powerful AI-powered chatbot that acts as your personal Spotify DJ. Simply tell the chatbot what kind of music you're in the mood for, and it will intelligently create a cu
I prepared a detailed guide showcasing the process of building an AI agent that interacts with a Snowflake database using n8n. This setup enables conversational querying, secure execution of SQL queri
Currently Work-In-Progress
Build your own AI Prompt Hub inside n8n. This template lets ChatGPT automatically search your saved prompts in Notion using semantic embeddings from HuggingFace. Each time a user sends a message, the
Chat with an AI and ask questions about your Meta Ads metrics.