Skip to main content

Route Chatwoot customer chats to AI and live agents with Groq and Gemini

Workflow preview

Workflow preview
100%
Route Chatwoot customer chats to AI and live agents with Groq and Gemini preview
Open on n8n.io

1. Workflow Overview

Quick overview This workflow automates customer chat with Chatwoot & n8n AI agent that handles incoming chats, qualifies leads, answers FAQs from Pinecone knowledge base, and escalates to a live hu...

Best for

  • Support Chatbot automation workflows
  • AI Chatbot automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.stickynote, n8n-nodes-base.if, n8n-nodes-base.code, n8n-nodes-base.switch, n8n-nodes-base.noop, n8n-nodes-base.httprequest, @n8n/n8n-nodes-langchain.memorypostgreschat, n8n-nodes-base.gmailtool

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Mohan Lal Dhanwani.

Original n8n.io source

1.1 Workflow description

Title
Route Chatwoot customer chats to AI and live agents with Groq and Gemini
Workflow name
Route Chatwoot customer chats to AI and live agents with Groq and Gemini

Quick overview

This workflow automates customer chat with Chatwoot & n8n AI agent that handles incoming chats, qualifies leads, answers FAQs from Pinecone knowledge base, and escalates to a live human agent when one is online. Works with any Chatwoot inbox: web widget, WhatsApp, Telegram, and more.

How it works

  1. Receives a POST webhook from Chatwoot when a message is created in a conversation.
  2. Extracts message and sender fields into a clean structure, then ignores outgoing messages to prevent the bot from replying to its own messages in an infinite loop.
  3. Stops processing if the Chatwoot conversation already has a human assignee (or is escalated to a human during chat) to avoid interrupting live support.
  4. Fetches available Chatwoot agents, selects a random online agent (if any), and passes the availability status to the AI assistant.
  5. Generates a response using Groq (chat model) with Postgres (Superbase) chat history, optionally retrieving answers from a Pinecone knowledge base using Google Gemini embeddings and chat completions.
  6. When escalation is required, assigns the selected Chatwoot agent to the conversation or sends an internal summary email via Gmail.
  7. Splits the AI output into short chunks and posts them back to the Chatwoot conversation for human-like short replies

Setup

  1. Chatwoot Agent Bot: In Chatwoot SuperAdmin Console → Agent Bots, create a new bot, and paste the n8n Webhook URL as Outgoing URL. Assign the bot to your inbox(es) in Bot Configuration settings of those inboxes.
  2. Credentials: Add credentials for Groq API, PostgreSQL (Superbase), Pinecone API, Google AI Studio (Gemini embeddings/chat), and Gmail OAuth2.
  3. Chatwoot config: Update the Chatwoot base URL and API access token in Chatwoot HTTP requests and the reply-sending code, and set your internal notification email address in the Gmail step.
  4. Knowledge base: Create and populate a Pinecone index (and namespace) for your FAQs/knowledge documents, then update the index/namespace values in the Pinecone vector store configuration.

Requirements

  • Chatwoot instance (self-hosted or Chatwoot Cloud) with at least one active inbox.
  • Groq API key, or feel free to use any other AI Provider
  • PostgreSQL database for conversation memory (Supabase free tier works well)
  • Pinecone account with an index populated with your FAQ documents
  • Google AI Studio API key for Gemini embeddings
  • Gmail account with OAuth2 configured for internal lead notifications

Customization

  • Swap the LLM: Replace the Groq Chat Model node with any LangChain-compatible model — OpenAI, Anthropic Claude, Google Gemini, or a local Ollama model
  • Swap the memory store: Replace Postgres Chat Memory with Redis or n8n's In-Memory store for lighter setups
  • Swap the vector store: Replace Pinecone with Supabase Vector, or if you prefer a different provider
  • Add or edit tools to the agent: Extend with a Google Calendar node for appointment booking, a HubSpot/CRM node for automatic lead creation, or any HTTP Request tool for custom APIs
  • Adjust reply chunking: Change the 300ms delay in the Send Reply node or the split pattern to control message pacing

Additional info

This template is production-tested and was built to solve a real problem: most Chatbot AI integrations are basic single-node setups that break when including multiple sources like Whatsapp, Live Chat, Telegram etc. for a seamless experience, and have long answers that don't feel human-like.

This workflow handles these — through Chatwoot as a medium to connect multiple inboxes and using n8n to power those with Back-end automation, this workflow can help users handle incoming chats across multiple platforms. Plus, it handles human handovers, and only replies when there's no human assigned to the chat.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Sticky Note6

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 2 - Check Live Agent Assignment

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.3

Block 3 - Split AI Messages

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 4 - Route by Chat Message Type

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.4

Block 5 - Skip Operation

Type / Role
n8n-nodes-base.noOp - noOp
Config choices
Version 1

Block 6 - Fetch Live Agent Data

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.3

Block 7 - Store Chat Memory in Postgres

Type / Role
@n8n/n8n-nodes-langchain.memoryPostgresChat - memoryPostgresChat
Config choices
Version 1.3

Block 8 - Send Internal Team Email

Type / Role
n8n-nodes-base.gmailTool - gmailTool
Config choices
Version 2.2

Block 9 - Escalate Chat via HTTP

Type / Role
n8n-nodes-base.httpRequestTool - httpRequestTool
Config choices
Version 4.3

Block 10 - Incoming Chat Webhook

Type / Role
n8n-nodes-base.webhook - webhook
Config choices
Version 2.1

Block 11 - Prepare Field Edits

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 12 - Use Groq Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatGroq - lmChatGroq
Config choices
Version 1

Block 13 - Utilize Pinecone Vector Store

Type / Role
@n8n/n8n-nodes-langchain.vectorStorePinecone - vectorStorePinecone
Config choices
Version 1.3

Block 14 - Generate Google Gemini Embeddings

Type / Role
@n8n/n8n-nodes-langchain.embeddingsGoogleGemini - embeddingsGoogleGemini
Config choices
Version 1

Block 15 - Implement Google Gemini Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatGoogleGemini - lmChatGoogleGemini
Config choices
Version 1

Block 16 - AI Customer Support Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 1.7

Block 17 - Access Knowledge Base

Type / Role
@n8n/n8n-nodes-langchain.toolVectorStore - toolVectorStore
Config choices
Version 1.1

Block 18 - Generate Assignee Agent ID

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 19 - Sticky Note7

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 20 - Sticky Note8

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 21 - Sticky Note9

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 22 - Sticky Note10

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 23 - Sticky Note11

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 24 - Sticky Note12

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Route Chatwoot customer chats to AI and live agents with Groq and Gemini
Complexity advanced
Nodes 24
Categories Support Chatbot, AI Chatbot
Author Mohan Lal Dhanwani
Published 31 May 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/16039/16039.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Route Chatwoot customer chats to AI and live agents with Groq and Gemini do?

Quick overview This workflow automates customer chat with Chatwoot & n8n AI agent that handles incoming chats, qualifies leads, answers FAQs from Pinecone knowledge base, and escalates to a live hu...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Support Chatbot, AI Chatbot use case.