基于AI的邮件收件箱管理器,集成GPT-4、Gmail和Slack
高级
这是一个Ticket Management, AI Summarization领域的自动化工作流,包含 22 个节点。主要使用 If, Gmail, Slack, GmailTrigger, OpenAi 等节点。 基于AI的邮件收件箱管理器,集成GPT-4、Gmail和Slack
前置要求
- •Google 账号和 Gmail API 凭证
- •Slack Bot Token 或 Webhook URL
- •OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "TbwP9QUjXidVVh4Z",
"meta": {
"instanceId": "53ff9c683c80138a3de625634237ce4a4994b3a21e1a7a30490f99aca9a547c5",
"templateCredsSetupCompleted": true
},
"name": "基于AI的邮件收件箱管理器,集成GPT-4、Gmail和Slack",
"tags": [],
"nodes": [
{
"id": "bbe4335e-71cd-480d-b021-b9e650fe8378",
"name": "Gmail触发器",
"type": "n8n-nodes-base.gmailTrigger",
"position": [
-704,
128
],
"parameters": {
"simple": false,
"filters": {
"labelIds": [
"UNREAD"
]
},
"options": {},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
}
},
"credentials": {
"gmailOAuth2": {
"id": "x421CCYwRnlCAGVd",
"name": "Gmail account"
}
},
"typeVersion": 1.2
},
{
"id": "4a50fc40-2859-42d4-87d3-6513e193fe17",
"name": "文本分类器",
"type": "@n8n/n8n-nodes-langchain.textClassifier",
"position": [
-480,
128
],
"parameters": {
"options": {},
"inputText": "={{ $json.text }}",
"categories": {
"categories": [
{
"category": "Internal",
"description": "=Emails from the parent domain (prvndigital.com) from employees. Keywords: request, inquiry,\nsupport, question, follow-up, feedback"
},
{
"category": "Customer Support",
"description": "=Emails related to ongoing communication with current clients or customers, including service\nrequests, feedback, support tickets, and inquiries. Keywords: request, inquiry, support, question,\nfollow-up, feedback"
},
{
"category": "Promotions",
"description": "=Emails related to marketing campaigns, promotional offers, newsletters, or business updates\nfrom partners. Typically these emails contain content aimed at engaging an audience or\nupdating them on promotions. Keywords: newsletter, promotion, offer, sale, campaign,\nmarketing, launch"
},
{
"category": "Admin/Finance",
"description": "=Emails related to admin or financial matters, such as invoices, billing statements, payment\nreminders, or expense reports. Anything involving transactions or accounting should fall under\nthis label. Keywords: invoice, payment, billing, receipt, financial, expense, account"
},
{
"category": "Sales Opportunities",
"description": "=Emails related to sales. These could include service inquiries, pricing requests, referrals etc."
}
]
}
},
"typeVersion": 1.1
},
{
"id": "ed818fb1-8087-4c2e-b175-c9bc8ea36f82",
"name": "OpenAI聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
-408,
448
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "vtB7cRl8RPBNwKAO",
"name": "n8n free OpenAI API credits"
}
},
"typeVersion": 1.2
},
{
"id": "b10b46ad-13df-4c1d-8608-21d3f8ba34f9",
"name": "促销类",
"type": "n8n-nodes-base.gmail",
"position": [
-128,
128
],
"webhookId": "b90ee8a2-30b5-4bc9-8458-cedc60302fa9",
"parameters": {
"labelIds": [
"Label_1545496588916418018"
],
"messageId": "={{ $json.id }}",
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"id": "x421CCYwRnlCAGVd",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "50754308-afe4-4299-acc0-02aebf248af3",
"name": "内部邮件",
"type": "n8n-nodes-base.gmail",
"position": [
-128,
-256
],
"webhookId": "b90ee8a2-30b5-4bc9-8458-cedc60302fa9",
"parameters": {
"labelIds": [
"Label_1524539159551949340"
],
"messageId": "={{ $json.id }}",
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"id": "x421CCYwRnlCAGVd",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "06cf291a-6f8d-4743-b8a1-1a17164508f0",
"name": "客户支持",
"type": "n8n-nodes-base.gmail",
"position": [
-128,
-64
],
"webhookId": "b90ee8a2-30b5-4bc9-8458-cedc60302fa9",
"parameters": {
"labelIds": [
"Label_4804911835581558556"
],
"messageId": "={{ $json.id }}",
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"id": "x421CCYwRnlCAGVd",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "f333483a-4d84-4d8b-846d-13b408d264a8",
"name": "行政/财务",
"type": "n8n-nodes-base.gmail",
"position": [
-128,
320
],
"webhookId": "b90ee8a2-30b5-4bc9-8458-cedc60302fa9",
"parameters": {
"labelIds": [
"Label_1226745938983889262"
],
"messageId": "={{ $json.id }}",
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"id": "x421CCYwRnlCAGVd",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "f7883340-b00d-4c77-b1a6-f2a2512190bc",
"name": "销售机会",
"type": "n8n-nodes-base.gmail",
"position": [
-128,
512
],
"webhookId": "b90ee8a2-30b5-4bc9-8458-cedc60302fa9",
"parameters": {
"labelIds": [
"Label_7406356819911928694"
],
"messageId": "={{ $json.id }}",
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"id": "x421CCYwRnlCAGVd",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "0c1e22e5-492d-48f9-bb9c-3387a85b16ee",
"name": "标记邮件为已读",
"type": "n8n-nodes-base.gmail",
"position": [
656,
160
],
"webhookId": "f669746f-295f-4acd-8ee2-04467f90b3ca",
"parameters": {
"messageId": "={{$ ('Text Classifier').item.json.id}}",
"operation": "markAsRead"
},
"credentials": {
"gmailOAuth2": {
"id": "x421CCYwRnlCAGVd",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "bc5bb950-c03a-4b3c-a70d-6a75f1c5f953",
"name": "调用模型",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
96,
128
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini",
"cachedResultName": "GPT-4O-MINI"
},
"options": {},
"messages": {
"values": [
{
"content": "=You are the Promotions Analyst in an AI email management system.\nYour role is to review incoming promotional emails, summarize the offer, and decide whether it’s\nworth pursuing further.\nInput:\n{{ $('Gmail Trigger').item.json.text }}\nOutput:\n• Summary – What is being offered?\n• Recommendation – Is this worth exploring further? (Yes/No + brief reason)"
}
]
},
"jsonOutput": true
},
"credentials": {
"openAiApi": {
"id": "vtB7cRl8RPBNwKAO",
"name": "n8n free OpenAI API credits"
}
},
"typeVersion": 1.8
},
{
"id": "dcfd27a4-6345-40e5-8edd-125f3b5438dc",
"name": "条件判断",
"type": "n8n-nodes-base.if",
"position": [
448,
128
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "ba4b6577-5d8e-495c-8ab5-a591f22af93e",
"operator": {
"type": "string",
"operation": "contains"
},
"leftValue": "={{ $json.message.content.Recommendation }}",
"rightValue": "yes"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "9fcf2dac-7101-42d8-9264-f84f0bd9bb47",
"name": "调用模型1",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
96,
-256
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini",
"cachedResultName": "GPT-4O-MINI"
},
"options": {},
"messages": {
"values": [
{
"content": "=You are an executive assistant handling internal emails from my team.\nRespond to high-priority emails with clarity and accuracy.\nInput:\n{{ $('Gmail Trigger').item.json.text }}\nOutput:\n• Subject\n• Message"
}
]
},
"jsonOutput": true
},
"credentials": {
"openAiApi": {
"id": "vtB7cRl8RPBNwKAO",
"name": "n8n free OpenAI API credits"
}
},
"typeVersion": 1.8
},
{
"id": "3f937b75-9107-4ea6-b2ab-3008eed89964",
"name": "调用模型2",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
96,
-64
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini",
"cachedResultName": "GPT-4O-MINI"
},
"options": {},
"messages": {
"values": [
{
"content": "=You are a customer service representative.\nRespond to customer inquiries clearly and accurately.\nIf the request is outside your scope, direct the user to: support@prvndigital.com\nInput:\n{{ $('Gmail Trigger').item.json.text }}\nOutput:\n• Subject\n• Message"
}
]
},
"jsonOutput": true
},
"credentials": {
"openAiApi": {
"id": "vtB7cRl8RPBNwKAO",
"name": "n8n free OpenAI API credits"
}
},
"typeVersion": 1.8
},
{
"id": "f5496329-133e-438b-a946-e064deb03874",
"name": "调用模型3",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
96,
320
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini",
"cachedResultName": "GPT-4O-MINI"
},
"options": {},
"messages": {
"values": [
{
"content": "=You are a Finance & Billing Assistant.\nReview incoming emails related to payments, invoices, or account charges. Summarize the key\ndetails clearly and concisely.\nInput:\n{{ $('Gmail Trigger').item.json.text }}\nOutput:\n• Subject\n• Summary"
}
]
},
"jsonOutput": true
},
"credentials": {
"openAiApi": {
"id": "vtB7cRl8RPBNwKAO",
"name": "n8n free OpenAI API credits"
}
},
"typeVersion": 1.8
},
{
"id": "e0523a68-8870-43fd-a879-c6f57e825e8f",
"name": "调用模型4",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
96,
512
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini",
"cachedResultName": "GPT-4O-MINI"
},
"options": {},
"messages": {
"values": [
{
"content": "=Your job is to read incoming emails related to the sale of our products or services and draft a\nconcise, professional response. Include relevant details such as the contact’s name, email,\nphone number, and any specific questions or requests they mentioned.\nInput:\n{{ $('Gmail Trigger').item.json.text }}\nOutput:\n• Subject – Appropriate subject line for your reply\n• Message – Drafted email response including relevant details\n- Notification - create a concise notification to be sent to a slack channel with the first line as\n\"New Sales Opportunity\" along with any relevant details"
}
]
},
"jsonOutput": true
},
"credentials": {
"openAiApi": {
"id": "vtB7cRl8RPBNwKAO",
"name": "n8n free OpenAI API credits"
}
},
"typeVersion": 1.8
},
{
"id": "5211bfae-d7f2-4002-bb91-9268fbbbc0ba",
"name": "创建草稿",
"type": "n8n-nodes-base.gmail",
"position": [
448,
-256
],
"webhookId": "32f52fd7-8ef7-4867-be94-b63100ffdfab",
"parameters": {
"message": "={{ $json,message.context.Message }}",
"options": {},
"subject": "={{ $json,message.context.Subject }}",
"resource": "draft"
},
"credentials": {
"gmailOAuth2": {
"id": "x421CCYwRnlCAGVd",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "7311a8ce-e2e4-41e5-9eb1-5a66115d6d68",
"name": "Slack",
"type": "n8n-nodes-base.slack",
"position": [
656,
-256
],
"webhookId": "ec7b1337-9db1-475f-b353-79dbbeb56587",
"parameters": {
"text": "Internal: New Draft Created ",
"select": "channel",
"channelId": {
"__rl": true,
"mode": "list",
"value": "C08KU6HK28H",
"cachedResultName": "playground"
},
"otherOptions": {},
"authentication": "oAuth2"
},
"typeVersion": 2.3
},
{
"id": "204628dd-5ba3-40ca-91e7-7a91ef742a8b",
"name": "创建草稿2",
"type": "n8n-nodes-base.gmail",
"position": [
432,
-80
],
"webhookId": "8ce3b709-9213-48af-9813-3e76a69dcec5",
"parameters": {
"message": "={{ $json.message.content.Message }}",
"options": {},
"subject": "={{ $json.message.content.Subject }}",
"resource": "draft"
},
"credentials": {
"gmailOAuth2": {
"id": "x421CCYwRnlCAGVd",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "bf4ed803-6429-4de1-9b73-5bc3186e6cc2",
"name": "创建草稿1",
"type": "n8n-nodes-base.gmail",
"position": [
448,
320
],
"webhookId": "8ce3b709-9213-48af-9813-3e76a69dcec5",
"parameters": {
"message": "={{ $json.message.content.Message }}",
"options": {},
"subject": "={{ $json.message.content.Subject }}",
"resource": "draft"
},
"credentials": {
"gmailOAuth2": {
"id": "x421CCYwRnlCAGVd",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "76540b20-6619-4aec-9312-89e27940420c",
"name": "Slack1",
"type": "n8n-nodes-base.slack",
"position": [
656,
496
],
"webhookId": "3e098b85-9de9-44ae-80ce-7a0adeece2c6",
"parameters": {
"text": "={{ $('OpenAI4').item.json.message.content.Notification }}",
"select": "channel",
"channelId": {
"__rl": true,
"mode": "list",
"value": "C08KU6HK28H",
"cachedResultName": "playground"
},
"otherOptions": {},
"authentication": "oAuth2"
},
"typeVersion": 2.3
},
{
"id": "23bafb22-a05a-4635-a698-c1bfd4b0d9e2",
"name": "创建草稿3",
"type": "n8n-nodes-base.gmail",
"position": [
432,
496
],
"webhookId": "8ce3b709-9213-48af-9813-3e76a69dcec5",
"parameters": {
"message": "={{ $json.message.content.Message }}",
"options": {},
"subject": "={{ $json.message.content.Subject }}",
"resource": "draft"
},
"credentials": {
"gmailOAuth2": {
"id": "x421CCYwRnlCAGVd",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "f9c7bbdf-e802-4f68-968a-ebf68ca521b6",
"name": "便签说明",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1376,
-352
],
"parameters": {
"width": 1088,
"height": 1680,
"content": "## 基于AI的邮件收件箱管理器"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "696854cc-592d-419d-9daf-8de6bb90b7af",
"connections": {
"If": {
"main": [
[],
[
{
"node": "Mark a message as read1",
"type": "main",
"index": 0
}
]
]
},
"Internal": {
"main": [
[
{
"node": "Message a model1",
"type": "main",
"index": 0
}
]
]
},
"Promotion": {
"main": [
[
{
"node": "Message a model",
"type": "main",
"index": 0
}
]
]
},
"Admin/Finance": {
"main": [
[
{
"node": "Message a model3",
"type": "main",
"index": 0
}
]
]
},
"Gmail Trigger": {
"main": [
[
{
"node": "Text Classifier",
"type": "main",
"index": 0
}
]
]
},
"Message a model": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"Text Classifier": {
"main": [
[
{
"node": "Internal",
"type": "main",
"index": 0
}
],
[
{
"node": "Customer Support",
"type": "main",
"index": 0
}
],
[
{
"node": "Promotion",
"type": "main",
"index": 0
}
],
[
{
"node": "Admin/Finance",
"type": "main",
"index": 0
}
],
[
{
"node": "Sales Opportunity",
"type": "main",
"index": 0
}
]
]
},
"Customer Support": {
"main": [
[
{
"node": "Message a model2",
"type": "main",
"index": 0
}
]
]
},
"Message a model1": {
"main": [
[
{
"node": "Create a draft",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "Text Classifier",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Sales Opportunity": {
"main": [
[
{
"node": "Message a model4",
"type": "main",
"index": 0
}
]
]
},
"Mark a message as read1": {
"main": [
[]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 工单管理, AI 摘要总结
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
SmartSupport流程:从邮件到Jira自动处理IT请求,附带Slack通知
通过AI解决方案和Slack提醒将邮件自动转换为Jira工单
If
Set
Jira
+10
25 节点Trung Tran
工单管理
主动智能客户支持中心
使用GPT-4、Gmail和Trello的自动邮件支持分诊
If
Code
Gmail
+6
14 节点Marth
工单管理
Gmail智能自动回复与分类系统
Gmail邮件分类与自动回复,使用GPT-4o和Google Sheets
Gmail
Gmail Trigger
Google Sheets
+4
18 节点Haruki Kuwai
工单管理
基于 Gmail 和 GPT 的 AI 驱动邮件分类与自动回复系统
使用 GPT-4.1-mini 分类和 Gmail 自动回复实现邮件分拣自动化
If
Set
Gmail
+8
24 节点Giovanni Beggiato
工单管理
收件箱助手
AI邮件助手:通过ChatGPT摘要和Slack摘要优先处理Gmail邮件
If
Code
Gmail
+5
14 节点Darsheel
工单管理
AI 客户支持分流与摘要系统
使用GPT-4o、Slack和CRM集成自动处理客户支持
If
Set
Code
+10
32 节点NodeAlchemy
工单管理