🛃 收件箱管理器
高级
这是一个Ticket Management, AI RAG领域的自动化工作流,包含 41 个节点。主要使用 If, Gmail, Switch, Telegram, GmailTool 等节点。 使用GPT-5、多代理AI和Pinecone数据库的自动邮件管理系统
前置要求
- •Google 账号和 Gmail API 凭证
- •Telegram Bot Token
- •OpenAI API Key
- •Pinecone API Key
使用的节点 (41)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "fBNlWkUYOtZBLaCW",
"meta": {
"instanceId": "78a1670eff69dde15237f8eb0f091c143c10cc5aee229aa0485d9ac17fc48ce6",
"templateCredsSetupCompleted": true
},
"name": "🛃 收件箱管理器",
"tags": [],
"nodes": [
{
"id": "6f7313b8-998e-4d95-acbf-d6bc15c7d732",
"name": "Gmail 触发器",
"type": "n8n-nodes-base.gmailTrigger",
"position": [
-512,
-16
],
"parameters": {
"simple": false,
"filters": {},
"options": {},
"pollTimes": {
"item": [
{}
]
}
},
"credentials": {
"gmailOAuth2": {
"id": "3ayhzuWezVASgiY3",
"name": "Gmail account"
}
},
"typeVersion": 1.3
},
{
"id": "81fe47ea-54df-4f75-8af8-cbe5fc97b9e3",
"name": "无操作,不执行任何操作",
"type": "n8n-nodes-base.noOp",
"position": [
208,
1616
],
"parameters": {},
"typeVersion": 1
},
{
"id": "758cc80b-aa48-43d0-b2ff-e681ddd48c49",
"name": "Embeddings OpenAI",
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"position": [
432,
-544
],
"parameters": {
"options": {}
},
"credentials": {
"openAiApi": {
"id": "bNSgNFwMYVwTQBvV",
"name": "n8n free OpenAI API credits"
}
},
"typeVersion": 1.2
},
{
"id": "f50f02b8-022b-4021-9f01-9e7a11ef15de",
"name": "回复邮件",
"type": "n8n-nodes-base.gmail",
"position": [
736,
-896
],
"webhookId": "6b6b3dd8-f052-4f44-b2f3-8c98312d6f89",
"parameters": {
"message": "={{ $json.output }}",
"options": {
"appendAttribution": false
},
"emailType": "text",
"messageId": "={{ $('Gmail Trigger').item.json.id }}",
"operation": "reply"
},
"credentials": {
"gmailOAuth2": {
"id": "3ayhzuWezVASgiY3",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "8a9e3306-aa3f-4acc-86cd-e9e891e94d8c",
"name": "客户支持代理",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
368,
-896
],
"parameters": {
"text": "={{ $json.text }}",
"options": {
"systemMessage": "=# Overview\nYou are a customer support agent. Your role is to respond to incoming emails with relevant information using the Database of FAQs and Policies tool. \n\n## Instructions\n- Use a friendly and engaging tone.\n- Sign off as \"Customer Support Team\"\n\n## Output\n- Output only the body content of the email"
},
"promptType": "define"
},
"typeVersion": 2.2
},
{
"id": "8d388b51-fc82-4ebd-8dd1-3fe18519d106",
"name": "财务代理",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
336,
-80
],
"parameters": {
"text": "=Here's a new email that came in: {{ $('Gmail Trigger').item.json.id }}\n\nSubject : {{ $('Gmail Trigger').item.json.headers.subject }}\nFrom : {{ $('Gmail Trigger').item.json.headers.from }}\nEmail body : {{ $('Gmail Trigger').item.json.text }}\n",
"options": {
"systemMessage": "=# Overview\nYou are a finance agent. Your role is to review incoming emails related to vendor payments or customer receipts and provide user with a summary of key details clearly and concisely. \n\n## Instructions\n- Label the email as Finance\n- Based on the input, classify if email is payment or receipts-related and reply according to the output\n- Vendor payment emails are those where sender is from any of the vendors talking about payments that I need to make\n- Receipts are those where sender is from customers who have paid for my services\n\n"
},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 2.2
},
{
"id": "244affcf-3bda-4fc7-8e3c-2dcda53bc3cc",
"name": "潜在客户代理",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
448,
592
],
"parameters": {
"text": "=Subject : {{ $json.headers.subject }}\nFrom : {{ $json.headers.from }}\nEmail : {{ $json.text }}",
"options": {
"systemMessage": "=# Overview\nYou are a sales leads agent. Your role is to review incoming emails from prospects that are sales-related and could be leads with inquiries requesting to book a discovery call or have questions about the services provided. \n\n## Instructions\n- Label the email as sales opportunities\n- If the email is about inquiries about the services, look to the database knowledge to find out an answer, draft an email reply, then notify me via telegram\n- If unsure what to reply, escalate it so I receive a notification via telegram text.\n\n\n"
},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 2.2
},
{
"id": "625a8b76-8523-4ddf-a3e6-bc503034e20c",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
192,
-1056
],
"parameters": {
"width": 1184,
"height": 672,
"content": "## 客户支持"
},
"typeVersion": 1
},
{
"id": "2e49380c-20bf-4909-9507-37e1b653e05c",
"name": "内部代理",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
480,
1264
],
"parameters": {
"text": "=Subject : {{ $json.headers.subject }}\nFrom : {{ $json.headers.from }}\nEmail : {{ $json.text }}",
"options": {
"systemMessage": "# Overview\nYou are an executive assistant that handles income emails from internal team members\n\n## Instructions\n- For emails that come from internal team, label them as Internal\n- Send a summary of the email and from who to user"
},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 2.2
},
{
"id": "6c233cf9-212b-4e9e-bf88-fd8a38752f68",
"name": "标记为 客户支持",
"type": "n8n-nodes-base.gmail",
"position": [
960,
-896
],
"webhookId": "aadb0038-d592-444b-a1d5-11100339b27c",
"parameters": {
"labelIds": [
"Label_4183721284522273805"
],
"messageId": "={{ $('Gmail Trigger').item.json.id }}",
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"id": "3ayhzuWezVASgiY3",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "cf82a1a4-b002-4235-82af-63f18942bd5b",
"name": "标记为 财务",
"type": "n8n-nodes-base.gmailTool",
"position": [
416,
96
],
"webhookId": "524d3a64-ad94-49a9-8930-71ac5fb464c8",
"parameters": {
"labelIds": [
"Label_1601308720640490413"
],
"messageId": "={{ $('Gmail Trigger').item.json.id }}",
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"id": "3ayhzuWezVASgiY3",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "02babaee-e872-45c8-b4e4-aab19c062b0d",
"name": "标记为 销售机会",
"type": "n8n-nodes-base.gmailTool",
"position": [
416,
816
],
"webhookId": "a01fb0ae-7d1d-4113-9edd-2ada8f69e4e9",
"parameters": {
"labelIds": [
"Label_3532739869741947436"
],
"messageId": "={{ $('Gmail Trigger').item.json.id }}",
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"id": "3ayhzuWezVASgiY3",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "9dc5dbaa-9b5e-449f-8c3b-5f8c645ac779",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
192,
-368
],
"parameters": {
"color": 5,
"width": 1184,
"height": 656,
"content": "## 财务代理"
},
"typeVersion": 1
},
{
"id": "9d203fa1-a54c-42ef-9886-4163a3123314",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
192,
304
],
"parameters": {
"color": 4,
"width": 1184,
"height": 800,
"content": "## 销售/潜在客户代理"
},
"typeVersion": 1
},
{
"id": "024318eb-5e25-494b-a3c6-72256ca7382e",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
192,
1120
],
"parameters": {
"color": 6,
"width": 1184,
"height": 448,
"content": "## Internal Agent \n- Any emails by team members will be routed here.\n- The agent will label it as \"internal\" and send a telegram message summarising its contents. **Note to input your personal ChatID in the telegram node\n"
},
"typeVersion": 1
},
{
"id": "0dfb0bbd-ab6c-4db6-97d2-e45983e996f2",
"name": "OpenAI 嵌入1",
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"position": [
608,
944
],
"parameters": {
"options": {}
},
"credentials": {
"openAiApi": {
"id": "bNSgNFwMYVwTQBvV",
"name": "n8n free OpenAI API credits"
}
},
"typeVersion": 1.2
},
{
"id": "2f643199-bc20-4e8a-8a83-c8a4697f4514",
"name": "Database of FAQs and Policies",
"type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
"position": [
448,
-688
],
"parameters": {
"mode": "retrieve-as-tool",
"options": {
"pineconeNamespace": "FAQ"
},
"pineconeIndex": {
"__rl": true,
"mode": "list",
"value": "chatbot",
"cachedResultName": "chatbot"
},
"toolDescription": "Call this tool to access Policy and FAQ information"
},
"credentials": {
"pineconeApi": {
"id": "bqH6qbFYtDUXMpn3",
"name": "PineconeApi v2"
}
},
"typeVersion": 1.3
},
{
"id": "ab484b41-257e-4fb5-aaf9-ab5c52e8f9d3",
"name": "Needs Review?",
"type": "n8n-nodes-base.if",
"position": [
848,
592
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "dc85cfc2-9c10-490b-beb7-aa7db8f7bf9f",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $json.output.escalate }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "c858664a-5f23-49a3-9f5a-3248d11caf6f",
"name": "GPT 4o mini",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
"position": [
304,
-688
],
"parameters": {
"model": "openai/gpt-4o-mini",
"options": {}
},
"credentials": {
"openRouterApi": {
"id": "8YhGo1rl7F0epmIo",
"name": "OpenRouter account"
}
},
"typeVersion": 1
},
{
"id": "21182b0b-a8c3-4e2c-b55a-0a0fa640497c",
"name": "GPT 4o mini1",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
"position": [
256,
96
],
"parameters": {
"model": "openai/gpt-4o-mini",
"options": {}
},
"credentials": {
"openRouterApi": {
"id": "8YhGo1rl7F0epmIo",
"name": "OpenRouter account"
}
},
"typeVersion": 1
},
{
"id": "aed022a4-79e1-4233-96bb-464ccb6b103a",
"name": "GPT 4o mini2",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
"position": [
256,
816
],
"parameters": {
"model": "openai/gpt-4o-mini",
"options": {}
},
"credentials": {
"openRouterApi": {
"id": "8YhGo1rl7F0epmIo",
"name": "OpenRouter account"
}
},
"typeVersion": 1
},
{
"id": "209217da-45df-4170-8876-bb2b39de9428",
"name": "GPT 4o mini3",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
"position": [
400,
1424
],
"parameters": {
"model": "openai/gpt-4o-mini",
"options": {}
},
"credentials": {
"openRouterApi": {
"id": "8YhGo1rl7F0epmIo",
"name": "OpenRouter account"
}
},
"typeVersion": 1
},
{
"id": "80791e3c-3b1c-498d-a89c-074aa1b226b8",
"name": "Inbox Router",
"type": "@n8n/n8n-nodes-langchain.textClassifier",
"position": [
-240,
-64
],
"parameters": {
"options": {},
"inputText": "=From: {{ $json.headers.from }}\nSubject: {{ $json.headers.subject }}\nEmail body: {{ $json.text }}",
"categories": {
"categories": [
{
"category": "Customer Support",
"description": "An email that is related to helping out a customer. They may be asking questions about our service requests, feedback, policies or questions about our product or services, support tickets, inquiries. Keywords: request, inquiry, support, question, follow-up, feedback."
},
{
"category": "Finance",
"description": "An email related to finances and accounting. These include invoices, billing statements, payment reminders, or expense reports. Keywords: invoice, payment, billing, receipt, financial, expense, account."
},
{
"category": "Others",
"description": "Any other emails that do not fall in any other category"
},
{
"category": "Sales Opportunities",
"description": "Emails related to sales which include service inquiries, pricing requests, referrals, new inquiries, booking calls, interested leads."
},
{
"category": "Internal",
"description": "Emails from the parent domain (xxx.com) from employees."
}
]
}
},
"typeVersion": 1.1
},
{
"id": "8913afc7-bd15-45f7-8d99-90c896220032",
"name": "Route by Email Type",
"type": "n8n-nodes-base.switch",
"position": [
656,
-80
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "Customer Receipts",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "f1922a62-8706-4edc-b1d7-6ce7d49f01ea",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $json.output.emailType }}",
"rightValue": ""
}
]
},
"renameOutput": true
},
{
"outputKey": "Vendor Invoice",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "474a86d4-7267-4c53-9153-54697e48a36b",
"operator": {
"type": "boolean",
"operation": "false",
"singleValue": true
},
"leftValue": "={{ $json.output.emailType }}",
"rightValue": ""
}
]
},
"renameOutput": true
}
]
},
"options": {}
},
"typeVersion": 3.2
},
{
"id": "9bd4da70-dcc0-411b-94ad-d9b8e3776403",
"name": "OutputFormat",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
560,
96
],
"parameters": {
"schemaType": "manual",
"inputSchema": "{\n\t\"type\": \"object\",\n\t\"properties\": {\n\t\t\"emailType\": {\n\t\t\t\"type\": \"boolean\",\n \"description\": \"True if email is customer receipts and False if vendor invoice\"\n\t\t},\n \"emailBody\": {\n \"type\": \"string\",\n \"description\": \"Summary of the email content\"\n },\n \"Amount\":{\n \"type\": \"number\",\n \"description\": \"Amount stated in the email to be paid or have received\"\n\t},\n \"From\": {\n \"type\": \"string\",\n \"description\":\"who the email is from\"\n },\n \"DueDate\": {\n \"type\": \"string\",\n \"description\":\"invoice payment due date\"\n }\n }\n}"
},
"typeVersion": 1.3
},
{
"id": "fb30770c-95fe-41d6-a4a4-78435f208df9",
"name": "Notify Amount Received",
"type": "n8n-nodes-base.telegram",
"position": [
1120,
-96
],
"webhookId": "3d493d94-8cbf-4def-9f42-088891197598",
"parameters": {
"text": "=📥 Income-ing! ${{ $json.output.Amount }} from {{ $json.output.From.split('<')[0].trim() }}",
"chatId": "=",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"id": "GroO0akGb3u44nyE",
"name": "Telegram: PA"
}
},
"typeVersion": 1.2
},
{
"id": "db1f46b9-b2bc-4584-b08e-a15420128415",
"name": "Notify Amount to Pay",
"type": "n8n-nodes-base.telegram",
"position": [
1120,
80
],
"webhookId": "2ceb728e-e912-4a9d-899b-8f1927947e3b",
"parameters": {
"text": "=💲Pay ${{ $json.output.Amount }} to {{ $json.output.From.split('<')[0].trim() }}",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "GroO0akGb3u44nyE",
"name": "Telegram: PA"
}
},
"typeVersion": 1.2
},
{
"id": "0fa94dfb-182d-4f29-bbd8-8e2d6f39948a",
"name": "Email Draft",
"type": "n8n-nodes-base.gmail",
"position": [
1024,
784
],
"webhookId": "f77c4bdb-4e13-4c85-8b89-36db26e5f5f4",
"parameters": {
"message": "={{ $json.output.emailBody }}",
"options": {},
"subject": "=Re: {{ $('Gmail Trigger').item.json.subject }}",
"resource": "draft",
"emailType": "html"
},
"credentials": {
"gmailOAuth2": {
"id": "3ayhzuWezVASgiY3",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "6cf3269e-0d32-498a-b96b-47f1252ec252",
"name": "Label as Internal",
"type": "n8n-nodes-base.gmailTool",
"position": [
560,
1424
],
"webhookId": "fd1cb537-e3fa-4bd4-86e8-89ab5f0ed376",
"parameters": {
"labelIds": [
"Label_2401692396070026182"
],
"messageId": "={{ $('Gmail Trigger').item.json.id }}",
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"id": "3ayhzuWezVASgiY3",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "43d657f4-4164-47c7-8d9b-59ee5fe889ca",
"name": "Send a message to user to review drafted reply",
"type": "n8n-nodes-base.telegram",
"position": [
1184,
784
],
"webhookId": "76ed07a0-9dd0-4a62-a97a-98c14a3d837a",
"parameters": {
"text": "=📥 New lead: {{ $('Gmail Trigger').item.json.from.value[0].name }}\nI searched the knowledge database and drafted a reply for you. Please check your email!\n\nFacts used:\n{{ $json.output.knowledgeDatabase }}\nRationale in email reply:\n{{ $json.output.reason }}",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"id": "GroO0akGb3u44nyE",
"name": "Telegram: PA"
}
},
"typeVersion": 1.2
},
{
"id": "0b3dbc39-ecb6-4a4c-8ddd-40c0c27ecab5",
"name": "Send a message to user to review the email directly",
"type": "n8n-nodes-base.telegram",
"position": [
1184,
576
],
"webhookId": "556fe74b-7219-4c7c-ac4a-abeb7093f25e",
"parameters": {
"text": "=📥 New lead: {{ $('Gmail Trigger').item.json.from.value[0].name }}\nI searched the knowledge database but I wasn't sure how to respond. Please see your email!",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "GroO0akGb3u44nyE",
"name": "Telegram: PA"
}
},
"typeVersion": 1.2
},
{
"id": "7b87e106-0a4c-49bd-a8f9-9d0cc9567e28",
"name": "Output Format",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
848,
816
],
"parameters": {
"schemaType": "manual",
"inputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"emailBody\": {\n \"type\": \"string\",\n \"description\": \"The HTML-formatted body content of the email reply to be sent to the prospect. Use <p>, <br>, and <a> tags for formatting. If escalate is true, this is not required.\"\n },\n \"reason\": {\n \"type\": \"string\",\n \"description\": \"Short explanation for why this email response was generated. For example, what the user asked for, what info was found, and why this response was appropriate.\"\n },\n \"escalate\": {\n \"type\": \"boolean\",\n \"description\": \"True if unsure or can't confidently answer the question using available knowledge. False if confident in response and can proceed without human help.\"\n },\n \"knowledgeDatabase\": {\n \"type\": \"string\",\n \"description\": \"A summary of the facts retrieved from the Knowledge Database that were used to answer the email.\"\n }\n }\n}\n"
},
"typeVersion": 1.3
},
{
"id": "c75d94e7-c9aa-42c8-92fc-0d15296d621d",
"name": "Output Format1",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
720,
1424
],
"parameters": {
"jsonSchemaExample": "{\n\t\"type\": \"object\",\n\t\"properties\": {\n \"emailBody\": {\n \"type\": \"string\",\n \"description\": \"Summary of the email content\"\n },\n \"From\": {\n \"type\": \"string\",\n \"description\":\"who the email is from\"\n }\n }\n}"
},
"typeVersion": 1.3
},
{
"id": "09789837-6aa1-4043-87f0-1207e3a01bea",
"name": "Send a summary of email and from who",
"type": "n8n-nodes-base.telegram",
"position": [
896,
1264
],
"webhookId": "edf1ba52-759c-4f5b-9193-ed93cb3bb798",
"parameters": {
"text": "={{ $json.output.From }} sent you an email about {{ $json.output.emailBody }} ",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "GroO0akGb3u44nyE",
"name": "Telegram: PA"
}
},
"typeVersion": 1.2
},
{
"id": "d43d4957-6117-4516-b6eb-3ac6a57dd5a5",
"name": "Send a message to Payments Team",
"type": "n8n-nodes-base.gmail",
"position": [
912,
80
],
"webhookId": "307f6a19-1c45-4153-a7ee-5399ed96bd87",
"parameters": {
"sendTo": "payment@payments.com",
"message": "=Invoice received from {{ $json.output.From }}. |Make payment by {{ $json.output.DueDate }}",
"options": {},
"subject": "=Make Payment to {{ $json.output.From }} by {{ $json.output.DueDate }}",
"emailType": "text"
},
"credentials": {
"gmailOAuth2": {
"id": "3ayhzuWezVASgiY3",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "01ffc8d4-ddaa-464c-ba20-0ec626dcf85c",
"name": "Send a message to Receivables Team",
"type": "n8n-nodes-base.gmail",
"position": [
912,
-96
],
"webhookId": "0b7881c6-b244-4b42-a651-1017df6fbcc5",
"parameters": {
"sendTo": "receipt@receivables.com",
"message": "=Note receipt {{ $json.output.Amount }} from {{ $json.output.From }} ",
"options": {},
"subject": "=Received {{ $json.output.Amount }} from {{ $json.output.From }} ",
"emailType": "text"
},
"credentials": {
"gmailOAuth2": {
"id": "3ayhzuWezVASgiY3",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "0779c8e1-600e-46d5-9b13-c35c55221f8a",
"name": "Database of Business Services",
"type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
"position": [
560,
816
],
"parameters": {
"mode": "retrieve-as-tool",
"options": {},
"pineconeIndex": {
"__rl": true,
"mode": "list",
"value": "chatbot",
"cachedResultName": "chatbot"
},
"toolDescription": "Knowledge of the business and services it provides"
},
"credentials": {
"pineconeApi": {
"id": "bqH6qbFYtDUXMpn3",
"name": "PineconeApi v2"
}
},
"typeVersion": 1.3
},
{
"id": "89ea2355-ee63-479a-a419-0a3d48d8217f",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-576,
-368
],
"parameters": {
"color": 3,
"width": 272,
"height": 704,
"content": "## Trigger\nWorkflow is triggered when an email comes in\n\n## Setup\n- Connect to your Gmail account using Gmail API"
},
"typeVersion": 1
},
{
"id": "c7f19fbe-bc82-49bf-a27d-910b342bd37a",
"name": "便签5",
"type": "n8n-nodes-base.stickyNote",
"position": [
-272,
-368
],
"parameters": {
"color": 3,
"width": 320,
"height": 704,
"content": "## Inbox Router\nBased on incoming email's \"subject\", \"from\", and \"content\", GPT will route the email to the respective designated categories.\n\n## Setup\n- Select email \"body\", \"subject\" and \"from\" for GPT to classify with\n- List down the categories you need and add a description for GPT to learn how to classify."
},
"typeVersion": 1
},
{
"id": "e75aab89-507b-4272-b5f8-11caa17ae9be",
"name": "GPT 5 mini",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
"position": [
-208,
208
],
"parameters": {
"model": "openai/gpt-5-mini",
"options": {}
},
"credentials": {
"openRouterApi": {
"id": "8YhGo1rl7F0epmIo",
"name": "OpenRouter account"
}
},
"typeVersion": 1
},
{
"id": "43ad74d1-c0d1-4324-8749-a68ced79faf6",
"name": "### 需要帮助?",
"type": "n8n-nodes-base.stickyNote",
"position": [
-528,
-1136
],
"parameters": {
"width": 640,
"height": 688,
"content": "## Categorise and route emails with GPT 5\nThis 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.\n\n## Use cases\nBusiness owners with a lot of incoming emails, or anyone who has huge influx of emails \n\n## How it Works\nAny incoming emails will be read by the text classifier powered by GPT 5, and routed according to the defined categories. See details of how it works in the respective categories.\n\n## How to set up\n- Set up Telegram bot via Botfather. See setup instructions [here](https://core.telegram.org/bots/tutorial) \n- Setup OpenAI API for transcription services (Credits required) [here](https://openai.com/index/openai-api/)\n- Set up Openrouter account. See details [here](https://openrouter.ai/docs/api-reference/authentication)\n- Set up Pinecone database. See details [here](https://docs.pinecone.io/guides/get-started/quickstart)\n\n## Customization Options\nOther than Gmail, it is possible to connect to Outlook as well. Other than Pinecone vector database, there are other vector database that should serve the same purpose eg. supabase, qdrant, weviate\n\n## Requirements\n- Gmail account\n- Telegram bot\n- Pinecone account\n- Open router account\n"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "84f34fe3-9a89-434b-be4c-e9b70eb9f5dc",
"connections": {
"GPT 5 mini": {
"ai_languageModel": [
[
{
"node": "Inbox Router",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Email Draft": {
"main": [
[
{
"node": "Send a message to user to review drafted reply",
"type": "main",
"index": 0
}
]
]
},
"GPT 4o mini": {
"ai_languageModel": [
[
{
"node": "Customer Support Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Leads Agent": {
"main": [
[
{
"node": "Needs Review?",
"type": "main",
"index": 0
}
]
]
},
"Reply Email": {
"main": [
[
{
"node": "Label as Customer Support",
"type": "main",
"index": 0
}
]
]
},
"GPT 4o mini1": {
"ai_languageModel": [
[
{
"node": "Finance Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"GPT 4o mini2": {
"ai_languageModel": [
[
{
"node": "Leads Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"GPT 4o mini3": {
"ai_languageModel": [
[
{
"node": "Internal Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Inbox Router": {
"main": [
[
{
"node": "Customer Support Agent",
"type": "main",
"index": 0
}
],
[
{
"node": "Finance Agent",
"type": "main",
"index": 0
}
],
[
{
"node": "No Operation, do nothing",
"type": "main",
"index": 0
}
],
[
{
"node": "Leads Agent",
"type": "main",
"index": 0
}
],
[
{
"node": "Internal Agent",
"type": "main",
"index": 0
}
]
]
},
"OutputFormat": {
"ai_outputParser": [
[
{
"node": "Finance Agent",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"Finance Agent": {
"main": [
[
{
"node": "Route by Email Type",
"type": "main",
"index": 0
}
]
]
},
"Gmail Trigger": {
"main": [
[
{
"node": "Inbox Router",
"type": "main",
"index": 0
}
]
]
},
"Needs Review?": {
"main": [
[
{
"node": "Send a message to user to review the email directly",
"type": "main",
"index": 0
}
],
[
{
"node": "Email Draft",
"type": "main",
"index": 0
}
]
]
},
"Output Format": {
"ai_outputParser": [
[
{
"node": "Leads Agent",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"Internal Agent": {
"main": [
[
{
"node": "Send a summary of email and from who",
"type": "main",
"index": 0
}
]
]
},
"Output Format1": {
"ai_outputParser": [
[
{
"node": "Internal Agent",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"Label as Finance": {
"ai_tool": [
[
{
"node": "Finance Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Embeddings OpenAI": {
"ai_embedding": [
[
{
"node": "Database of FAQs and Policies",
"type": "ai_embedding",
"index": 0
}
]
]
},
"Label as Internal": {
"ai_tool": [
[
{
"node": "Internal Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Embeddings OpenAI1": {
"ai_embedding": [
[
{
"node": "Database of Business Services",
"type": "ai_embedding",
"index": 0
}
]
]
},
"Route by Email Type": {
"main": [
[
{
"node": "Send a message to Receivables Team",
"type": "main",
"index": 0
}
],
[
{
"node": "Send a message to Payments Team",
"type": "main",
"index": 0
}
]
]
},
"Customer Support Agent": {
"main": [
[
{
"node": "Reply Email",
"type": "main",
"index": 0
}
]
]
},
"Label as Sales Opportunities": {
"ai_tool": [
[
{
"node": "Leads Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Database of Business Services": {
"ai_tool": [
[
{
"node": "Leads Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Database of FAQs and Policies": {
"ai_tool": [
[
{
"node": "Customer Support Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Send a message to Payments Team": {
"main": [
[
{
"node": "Notify Amount to Pay",
"type": "main",
"index": 0
}
]
]
},
"Send a message to Receivables Team": {
"main": [
[
{
"node": "Notify Amount Received",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 工单管理, AI RAG 检索增强
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
使用GPT、Google日历和Supabase的自动邮件管理系统
使用GPT、Google日历和Supabase的自动邮件管理系统
If
Code
Gmail
+15
42 节点Abdul Mir
工单管理
AI邮件分诊与GPT-4警报系统及Telegram通知
AI邮件分诊与GPT-4警报系统及Telegram通知
If
Set
Gmail
+22
104 节点Peter Joslyn
客户支持
AI驱动的邮件分诊与自动回复系统,集成OpenAI代理和Gmail
AI驱动的邮件分诊与自动回复系统,集成OpenAI代理和Gmail
If
Set
Gmail
+20
68 节点Abdullahi Ahmed
内容创作
正式 Gmail 草稿已更新
使用 GPT-4.1、Pinecone RAG 和 Gmail 的自动化产品邮件支持
If
Gmail
Gmail Trigger
+8
18 节点Fayzul Noor
工单管理
在可视化参考库中探索n8n节点
在可视化参考库中探索n8n节点
If
Ftp
Set
+93
113 节点I versus AI
其他
使用GPT-4整理Gmail并通过Telegram和WhatsApp发送紧急通知
通过GPT-4整理Gmail,并使用Telegram和WhatsApp发送紧急通知
If
Code
Wait
+14
28 节点Iniyavan JC
工单管理