This workflow corresponds to n8n.io template #9414 — we link there as the canonical source.
This workflow follows the Agent → OpenAI Embeddings 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": "CUKGI0izi0AiPcTi",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "Customer Support Workflow",
"tags": [],
"nodes": [
{
"id": "c21b53e9-1422-4be5-b8aa-e6c9fe2f2ed4",
"name": "Gmail Trigger",
"type": "n8n-nodes-base.gmailTrigger",
"position": [
-48,
240
],
"parameters": {
"simple": false,
"filters": {},
"options": {},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
}
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "4ac4150d-8d4c-4d19-a4e9-9b4ad2bf6805",
"name": "Text Classifier",
"type": "@n8n/n8n-nodes-langchain.textClassifier",
"position": [
160,
240
],
"parameters": {
"options": {},
"inputText": "={{ $json.text }}",
"categories": {
"categories": [
{
"category": "Customer Support ",
"description": "An email that is related to helping out a costumer. They may be asking questions about our policies or questions or questions about our products or services. Adding to that A customer email typically includes a greeting, a clear question or problem, relevant details like an order number or account information, and a polite closing. It is written in natural language and usually asks for help, information, or action.\n\nHere is an Example: \n\nSubject: Issue with My Recent Order\n\nHi there,\n\nI placed an order (#12345) last week, but I haven\u2019t received a shipping confirmation yet. Can you please check the status for me?\n\nThanks in advance!\n\nBest,\nJohn Doe\n"
},
{
"category": "Other ",
"description": "Any email that is not Costumer Support related "
}
]
}
},
"typeVersion": 1.1
},
{
"id": "a141facb-644c-4d19-8fdc-44a17d9ee330",
"name": "OpenRouter Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
"position": [
272,
656
],
"parameters": {
"options": {}
},
"credentials": {
"openRouterApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "b6e7d92c-fe48-4790-bb13-11242097a67e",
"name": "No Operation, do nothing",
"type": "n8n-nodes-base.noOp",
"position": [
608,
416
],
"parameters": {},
"typeVersion": 1
},
{
"id": "a279b9cc-00ff-4a81-b98e-139b77d960f0",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
560,
32
],
"parameters": {
"text": "={{ $('Gmail Trigger').item.json.text }}",
"options": {
"systemMessage": "=# Overview \nYou are a customer support agent for Tech Haven. Your job is to respond to incoming emails with relevant information using your knowledgeBase tool. \n\n# Instructions \n- Your output should be friendly and give as detailed information as possbile \n- Sign off as Mrs. Helpful from Tech Haven Solutions \n\n## Output \n- Output only the body content of the email "
},
"promptType": "define"
},
"typeVersion": 2.1
},
{
"id": "2f763a56-7c2d-4317-9df2-cb38d2176b9f",
"name": "OpenRouter Chat Model1",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
"position": [
560,
224
],
"parameters": {
"model": "google/gemini-2.0-flash-001",
"options": {}
},
"credentials": {
"openRouterApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "f8d50a89-7a5c-4088-861c-ce238e42e908",
"name": "knowledgeBase",
"type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
"position": [
864,
272
],
"parameters": {
"mode": "retrieve-as-tool",
"options": {
"pineconeNamespace": "FAQ"
},
"pineconeIndex": {
"__rl": true,
"mode": "list",
"value": "sample",
"cachedResultName": "sample"
},
"toolDescription": "Name: knowledgeBase\n\nCall this tool to [your Database] information"
},
"credentials": {
"pineconeApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.3
},
{
"id": "5c4edd48-ac92-4a2a-8261-40ecbe322df6",
"name": "Embeddings OpenAI",
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"position": [
960,
432
],
"parameters": {
"options": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "e3b08b15-3e88-407c-91bb-1bef981acf48",
"name": "Reply to a message",
"type": "n8n-nodes-base.gmail",
"position": [
1072,
32
],
"parameters": {
"message": "={{ $json.output }}",
"options": {
"appendAttribution": false
},
"emailType": "text",
"messageId": "={{ $('Gmail Trigger').item.json.id }}",
"operation": "reply"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "93fe6d9e-3c6b-4980-a003-35cb603e7099",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-304,
-48
],
"parameters": {
"width": 400,
"height": 592,
"content": "## Gmail Trigger \n- How it Works: Listens for new incoming Gmail messages in real time.\n- Value: Automatically pulls new customer emails into the workflow without manual checking.\n- Credentials: Connect your Gmail account using Gmail OAuth2.\n"
},
"typeVersion": 1
},
{
"id": "af395655-6228-4838-8aee-2bcba241dca0",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
112,
-48
],
"parameters": {
"color": 2,
"width": 288,
"height": 592,
"content": "## Text Classifier\n- How it Works: Uses AI to classify emails into Customer Support or Other.\n- Value: Ensures only relevant customer support emails get a response.\n- Credentials: None required (uses built-in LangChain classifier)."
},
"typeVersion": 1
},
{
"id": "3048d5d3-b301-4a79-a3ac-39bd57f99e10",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-304,
560
],
"parameters": {
"color": 3,
"width": 704,
"height": 256,
"content": "## OpenRouter Chat Model \n- How it Works: Provides AI-powered text generation for classification and responses.\n- Value: Enhances classification and helps prepare structured input for the agent.\n- Credentials: Connect your OpenRouter API key."
},
"typeVersion": 1
},
{
"id": "473c68ec-f0b0-4a2a-86ca-1abc25fa01e9",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
448,
-208
],
"parameters": {
"color": 4,
"width": 464,
"height": 208,
"content": "## AI Agent \n- How it Works: Acts as a virtual support agent. It takes customer emails, retrieves policy/FAQ info, and drafts a helpful reply.\n- Value: Saves time by providing accurate, personalized, and friendly responses automatically.\n- Credentials: Requires OpenRouter API and connection to Pinecone knowledge base."
},
"typeVersion": 1
},
{
"id": "8ea803ef-4f38-4611-928e-fb3ddd833f45",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
1152,
272
],
"parameters": {
"width": 288,
"height": 320,
"content": "## KnowledgeBase \n- How it Works: Stores and retrieves your Database information.\n- Value: Ensures responses are consistent and based on verified knowledge.\n- Credentials: Connect your Pinecone API credentials."
},
"typeVersion": 1
},
{
"id": "540a4355-c133-488b-b5c3-8b53a9417379",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
880,
608
],
"parameters": {
"color": 6,
"width": 560,
"height": 208,
"content": "## Embeddings (OpenAI)\n- How it Works: Converts FAQ text into embeddings so the AI can search and retrieve relevant information.\n- Value: Improves accuracy of answers by grounding responses in real data.\n- Credentials: Connect your OpenAI API key."
},
"typeVersion": 1
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "72b878a4-7173-40ae-952e-999765d1728a",
"connections": {
"AI Agent": {
"main": [
[
{
"node": "Reply to a message",
"type": "main",
"index": 0
}
]
]
},
"Gmail Trigger": {
"main": [
[
{
"node": "Text Classifier",
"type": "main",
"index": 0
}
]
]
},
"knowledgeBase": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Text Classifier": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
],
[
{
"node": "No Operation, do nothing",
"type": "main",
"index": 0
}
]
]
},
"Embeddings OpenAI": {
"ai_embedding": [
[
{
"node": "knowledgeBase",
"type": "ai_embedding",
"index": 0
}
]
]
},
"OpenRouter Chat Model": {
"ai_languageModel": [
[
{
"node": "Text Classifier",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"OpenRouter Chat Model1": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"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.
gmailOAuth2openAiApiopenRouterApipineconeApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow automates customer email support by combining Gmail, AI classification, and a knowledge base to provide instant, accurate, and friendly responses. It’s designed for businesses that want to improve customer satisfaction while reducing manual workload. Gmail Trigger…
Source: https://n8n.io/workflows/9414/ — 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 automatically classifies incoming emails (Sales, Support, Internal, Finance, Promotions) and routes them to a dedicated OpenAI LLM Agent for processing. Depending on the category, th
This workflow demonstrates how to use AI text classifier to classify incoming emails, and uses a multi-agent architecture to respond for each email category respectively.
Unlock unparalleled efficiency and elevate customer satisfaction with our AI-Powered Customer Support: Email, Knowledge Base & Human Escalation Automation template. This sophisticated n8n workflow is
This n8n template demonstrates how to build an AI-powered customer support workflow that automatically handles incoming Gmail messages, classifies them, finds answers from your knowledge base, and sen
This workflow turns your Gmail inbox into an AI-powered customer support assistant using Google Gemini, OpenAI embeddings, and Pinecone vector search. It automatically classifies incoming emails, retr