Build a powerful multichannel customer support AI assistant using this n8n workflow. Integrates Chatwoot webhooks with OpenRouter/LLMs to automatically respond to user queries using a defined knowledge base.
Download this n8n workflow template and start using it instantly.
Businesses using Chatwoot across multiple communication channels (WhatsApp, Telegram, etc.).
Support teams looking to automate level-1 responses using a constrained knowledge base.
Developers seeking an advanced n8n workflow template for building custom LLM-powered integrations.
Anyone needing an n8n solution to prevent infinite reply loops in webhook-triggered chat bots.
This comprehensive n8n workflow provides a robust solution for deploying an automated AI assistant directly into your Chatwoot customer support platform. By integrating Chatwoot’s webhook system with the power of modern Language Models (LLMs) via OpenRouter, this n8n workflow ensures that every incoming customer query across all connected channels receives a fast, consistent, and knowledge-based response.
The primary value of this n8n templates is its sophisticated architecture: it fetches the full conversation history, processes it into a clean, context-rich format, and utilizes strict prompting directives to ensure the AI assistant adheres only to a pre-defined knowledge base, minimizing hallucinations. Furthermore, the inclusion of a crucial 'Check If Incoming Message' n8n node prevents reply loops, a common pitfall in chatbot automation. This n8n workflow is the perfect foundation for building scalable, multichannel AI support systems.
The n8n workflow begins execution immediately upon receiving a message created event via the Chatwoot Webhook n8n trigger.
Set n8n node extracts and structures only the necessary conversation and account IDs (convid, accountid).If n8n node checks if the message type is strictly "incoming". This step is critical; if the message is not incoming (i.e., it's an agent reply or the AI’s own outgoing message), the n8n workflow stops, preventing an endless conversation loop.HTTP Request n8n node uses the extracted IDs to call the Chatwoot API and load the full conversation history.Code n8n node processes this history. It cleans the data, identifies senders as 'user' or 'assistant', and formats the entire thread into a single, delimited string ([USER] : message \n [ASSISTANT] : reply). This structured input is ideal for the language model.Chatwoot Assistant n8n node (a LangChain LLM chain) receives the formatted history. It uses the OpenRouter Chat Model to apply a detailed System Prompt that defines its role and restricts its answers strictly to the provided knowledge base, ensuring accurate, focused support.HTTP Request n8n node uses the generated AI text, along with the original accountid and convid, to post the outgoing assistant message back into the Chatwoot conversation. This completes the automated response cycle in this powerful n8n workflow.To use this powerful n8n templates, follow these steps:
Chatwoot Webhook n8n trigger node and copy its unique URL.message created event is selected.OpenRouter Chat Model n8n node and set up your OpenRouter API credentials.URL parameter in both Load Chatwoot Conversation History and Send Message n8n nodes, replacing https://yourchatwooturl.com with your actual Chatwoot domain.HTTP Request n8n nodes, replace YOURACCESSTOKEN with a valid Chatwoot Super Admin API access token. This is required for fetching history and posting replies. Chatwoot Webhook (n8n trigger):
Function: Acts as the entry point for this n8n workflow, listening for POST requests from Chatwoot whenever a message is created in any integrated channel. It is the core n8n trigger.
Key Configuration: Configured to a specific webhookId and path for receiving the message created event.
Squize Webhook Data (Set n8n node):
Function: Cleans the bulky incoming JSON payload, extracting essential metadata like accountid, convid, and messagecontent using expression variables.
Check If Incoming Message (If n8n node):
Function: Implements flow control, proceeding only if the received messagetype equals "incoming." This is a crucial defense against infinite automation loops in this n8n workflow.
Load Chatwoot Conversation History (HTTP Request n8n node):
Function: Authenticates with the Chatwoot API token to retrieve all preceding messages in the current conversation, ensuring the AI has full context before responding.
Process Loaded History (Code n8n node):
Function: Transforms the raw conversation history array into a single, structured string ([ROLE]: Content), making it optimized for the subsequent LLM call. It correctly assigns user and assistant roles.
Chatwoot Assistant (LangChain LLM Chain n8n node):
Function: The core intelligence of the n8n workflow. It uses the input history and a detailed prompt to generate a knowledge-based answer, constrained by the built-in KNOWLEDGE BASE section.
Send Message (HTTP Request n8n node):
* Function: Posts the AI-generated response ({{ $json.text }}) back to the specific Chatwoot conversation, marked as an outgoing message.
Implement a powerful AI Telegram bot using this n8n workflow. Features include Gemini chat, voice transcription, RAG knowledge base search (Qdrant), and Google Suite automation.

Use this powerful n8n workflow template to automate multi-site web scraping. Fetch URLs from Google Sheets, route requests based on source, apply rate limiting, and use custom n8n node logic for content extraction and freshness filtering.

Build a sophisticated multi-modal Telegram AI assistant using n8n workflow templates. Features include Gemini chat, voice transcription, image generation, and MongoDB long-term memory.

Create a robust Retrieval-Augmented Generation (RAG) system using an n8n workflow. Integrate Mistral OCR for PDF extraction, Qdrant vector storage, and Gemini AI for conversational Q&A.

Building AI Systems & Multi-Agent Assistants incorporating data collection, intent classification, human handoff, RAG, and API-driven CRM actions. 10+ years in software development including iOS and Android. Now in the process of founding my AI Automation Platform - Agenza AI.







































