收件箱助手
中级
这是一个Ticket Management、AI Summarization领域的自动化工作流,包含 14 个节点。主要使用 If、Code、Gmail、Slack、GmailTrigger 等节点。 AI邮件助手:通过ChatGPT摘要和Slack摘要优先处理Gmail邮件
前置要求
- •Google 账号和 Gmail API 凭证
- •Slack Bot Token 或 Webhook URL
- •Google Sheets API 凭证
- •OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "SjqkLDL6TjA4qhXe",
"meta": {
"instanceId": "b37534993660b16a153506cfc0b71f79e6887c5743e20be7be0d1ad118ae0486",
"templateCredsSetupCompleted": true
},
"name": "InboxPilot",
"tags": [],
"nodes": [
{
"id": "66e1eca5-d977-4ead-8138-8eab926dfbfb",
"name": "Gmail 触发器",
"type": "n8n-nodes-base.gmailTrigger",
"position": [
0,
0
],
"parameters": {
"filters": {},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
}
},
"credentials": {
"gmailOAuth2": {
"id": "jwGNRLOxPPW8br4P",
"name": "Gmail account 2"
}
},
"typeVersion": 1.2
},
{
"id": "87e1fc81-4e18-4f7b-b3f3-d4cdc8f740a6",
"name": "向模型发送消息",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
220,
0
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini",
"cachedResultName": "GPT-4O-MINI"
},
"options": {},
"messages": {
"values": [
{
"content": "=You're an email assistant for a busy startup founder. Classify the email content into the following fields and return **only raw JSON** (no markdown):\n\n{\n \"summary\": [Short summary of the email in 1 sentence],\n \"urgency\": [High, Medium, Low],\n \"category\": [Investor, Customer Lead, Support, Spam, Other],\n \"intent\": [Short phrase, like \"Request for call\", \"Feature request\", \"Follow-up\"]\n}\n\nAnalyze the following email:\n\nSubject: {{ $json.Subject }}\nBody: {{ $json.snippet }}\n\nReturn only valid JSON with no extra formatting.\n"
}
]
}
},
"credentials": {
"openAiApi": {
"id": "aJq3jnvAs37EGBXF",
"name": "n8n free OpenAI API credits"
}
},
"typeVersion": 1.8
},
{
"id": "c457ff9f-2b06-4b15-91e8-41fb9dff5ffa",
"name": "如果",
"type": "n8n-nodes-base.if",
"position": [
880,
0
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "or",
"conditions": [
{
"id": "1ec24de2-2e64-4386-aa00-62603a63aef5",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.urgency }}",
"rightValue": "High"
},
{
"id": "0ed8beae-9ef7-46b7-9aca-5cd83412bceb",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.urgency }}",
"rightValue": "Medium"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "ce7d28e9-9ace-4ec8-8408-0d7e6059675f",
"name": "代码",
"type": "n8n-nodes-base.code",
"position": [
580,
0
],
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "let raw = $json.message?.content || $json.message || \"\";\n\n// Remove triple backticks (```json ... ```)\nraw = raw.replace(/```json|```/g, '').trim();\n\n// Fix smart quotes and other formatting problems\nraw = raw.replace(/[“”]/g, '\"').replace(/[‘’]/g, \"'\");\n\ntry {\n const parsed = JSON.parse(raw);\n\n return {\n summary: parsed.summary || \"No summary provided\",\n urgency: parsed.urgency || \"Unknown\",\n category: parsed.category || \"Unknown\",\n intent: parsed.intent || \"Unknown\"\n };\n} catch (err) {\n return {\n summary: \"⚠️ Failed to parse GPT output\",\n urgency: \"Unknown\",\n category: \"Unknown\",\n intent: \"Unknown\",\n error: err.message,\n original: raw\n };\n}\n"
},
"typeVersion": 2
},
{
"id": "353b70b5-eaad-4636-9bed-23aec2556d47",
"name": "发送消息",
"type": "n8n-nodes-base.slack",
"position": [
1080,
-100
],
"webhookId": "8d75cfb9-ac55-4745-b37d-013995518ff1",
"parameters": {
"text": "=📬 *Important Email Detected* *Summary:* {{ $('Code').item.json.summary }} *Urgency:* {{ $('Code').item.json.urgency }} 📥 From: {{ $('Gmail Trigger').item.json.From }}",
"select": "channel",
"channelId": {
"__rl": true,
"mode": "list",
"value": "C093BMY0ESX",
"cachedResultName": "alerts"
},
"otherOptions": {},
"authentication": "oAuth2"
},
"credentials": {
"slackOAuth2Api": {
"id": "Af5ru4q6Grpps5kG",
"name": "Slack account"
}
},
"typeVersion": 2.3
},
{
"id": "e9d6f184-b2ef-41aa-9df0-e58861a93a2e",
"name": "为消息添加标签",
"type": "n8n-nodes-base.gmail",
"position": [
1080,
40
],
"webhookId": "2e09aafe-567b-4205-8905-bc0cafee56cb",
"parameters": {
"labelIds": [
"Label_2"
],
"messageId": "={{ $node[\"Gmail Trigger\"].json[\"id\"] }}",
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"id": "jwGNRLOxPPW8br4P",
"name": "Gmail account 2"
}
},
"typeVersion": 2.1
},
{
"id": "f1109948-ab40-4f82-84f7-23fdbfc40d6b",
"name": "为消息添加标签1",
"type": "n8n-nodes-base.gmail",
"position": [
1300,
-100
],
"webhookId": "2e09aafe-567b-4205-8905-bc0cafee56cb",
"parameters": {
"labelIds": [
"Label_4585164412428469148"
],
"messageId": "={{ $node[\"Gmail Trigger\"].json[\"id\"] }}",
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"id": "jwGNRLOxPPW8br4P",
"name": "Gmail account 2"
}
},
"typeVersion": 2.1
},
{
"id": "73ea5151-4ef3-43b7-a73e-cd5d7f736363",
"name": "在表格中追加行",
"type": "n8n-nodes-base.googleSheets",
"position": [
1520,
-100
],
"parameters": {
"columns": {
"value": {
"From": "={{ $('Gmail Trigger').item.json.From }}",
"Summary": "={{ $('Code').item.json.summary }}",
"Urgency": "={{ $('Code').item.json.urgency }}",
"Category": "={{ $('Code').item.json.category }}",
"Timestamp": "={{ $now }}"
},
"schema": [
{
"id": "Timestamp",
"type": "string",
"display": true,
"required": false,
"displayName": "Timestamp",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "From",
"type": "string",
"display": true,
"required": false,
"displayName": "From",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Summary",
"type": "string",
"display": true,
"required": false,
"displayName": "Summary",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Urgency",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Urgency",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Category",
"type": "string",
"display": true,
"required": false,
"displayName": "Category",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1YQgWOSF-UA9gR1_pc6RzJ3UeANqnqi29ldoUd_2CPug/edit#gid=0",
"cachedResultName": "Sheet1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1YQgWOSF-UA9gR1_pc6RzJ3UeANqnqi29ldoUd_2CPug",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1YQgWOSF-UA9gR1_pc6RzJ3UeANqnqi29ldoUd_2CPug/edit?usp=drivesdk",
"cachedResultName": "Inbox Log"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "1HFV5dnUJndtPhEM",
"name": "Google Sheets account"
}
},
"typeVersion": 4.6
},
{
"id": "c588a35e-0230-4134-bf06-d6a0d3d5cda1",
"name": "在表格1中追加行",
"type": "n8n-nodes-base.googleSheets",
"position": [
1300,
60
],
"parameters": {
"columns": {
"value": {
"From": "={{ $('Gmail Trigger').item.json.From }}",
"Summary": "={{ $('Code').item.json.summary }}",
"Urgency": "={{ $('Code').item.json.urgency }}",
"Category": "={{ $('Code').item.json.category }}",
"Timestamp": "={{ $now }}"
},
"schema": [
{
"id": "Timestamp",
"type": "string",
"display": true,
"required": false,
"displayName": "Timestamp",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "From",
"type": "string",
"display": true,
"required": false,
"displayName": "From",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Summary",
"type": "string",
"display": true,
"required": false,
"displayName": "Summary",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Urgency",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Urgency",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Category",
"type": "string",
"display": true,
"required": false,
"displayName": "Category",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1YQgWOSF-UA9gR1_pc6RzJ3UeANqnqi29ldoUd_2CPug/edit#gid=0",
"cachedResultName": "Sheet1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1YQgWOSF-UA9gR1_pc6RzJ3UeANqnqi29ldoUd_2CPug",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1YQgWOSF-UA9gR1_pc6RzJ3UeANqnqi29ldoUd_2CPug/edit?usp=drivesdk",
"cachedResultName": "Inbox Log"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "1HFV5dnUJndtPhEM",
"name": "Google Sheets account"
}
},
"typeVersion": 4.6
},
{
"id": "8f2cd361-317c-4aab-8712-4ac47d337af3",
"name": "计划触发器",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
0,
220
],
"parameters": {
"rule": {
"interval": [
{
"triggerAtHour": 19
}
]
}
},
"typeVersion": 1.2
},
{
"id": "34161afd-e52b-4d6d-a973-9c4c63cd218c",
"name": "获取表中的行",
"type": "n8n-nodes-base.googleSheets",
"position": [
220,
220
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1YQgWOSF-UA9gR1_pc6RzJ3UeANqnqi29ldoUd_2CPug/edit#gid=0",
"cachedResultName": "Sheet1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1YQgWOSF-UA9gR1_pc6RzJ3UeANqnqi29ldoUd_2CPug",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1YQgWOSF-UA9gR1_pc6RzJ3UeANqnqi29ldoUd_2CPug/edit?usp=drivesdk",
"cachedResultName": "Inbox Log"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "1HFV5dnUJndtPhEM",
"name": "Google Sheets account"
}
},
"typeVersion": 4.6
},
{
"id": "d8eeb0ff-6d67-4586-8512-4d4da995de27",
"name": "代码1",
"type": "n8n-nodes-base.code",
"position": [
440,
220
],
"parameters": {
"jsCode": "const today = new Date().toISOString().split(\"T\")[0];\n\nreturn items.filter(item => {\n const timestamp = item.json.Timestamp || item.json.timestamp || \"\";\n const urgency = (item.json.Urgency || item.json.urgency || \"\").toLowerCase();\n\n const rowDate = new Date(timestamp).toISOString().split(\"T\")[0];\n\n return rowDate === today && (urgency === \"high\" || urgency === \"medium\");\n});\n"
},
"typeVersion": 2
},
{
"id": "fbe2ac0e-b671-4bff-9ef1-db9abb7fc23c",
"name": "Code2",
"type": "n8n-nodes-base.code",
"position": [
660,
220
],
"parameters": {
"jsCode": "let text = `🗓️ *Daily Digest – ${new Date().toLocaleDateString()}*\\n\\n`;\n\nif (items.length === 0) {\n text += \"_No important messages today._\";\n} else {\n items.forEach((item, index) => {\n text += `*${index + 1}.* ${item.json.Summary || \"No summary\"}\\nUrgency: ${item.json.Urgency || \"Unknown\"}\\nCategory: ${item.json.Category || \"Unknown\"}\\nIntent: ${item.json.Intent || \"N/A\"}\\n\\n`;\n });\n}\n\nreturn [{ json: { text } }];\n"
},
"typeVersion": 2
},
{
"id": "1ec81105-9ac6-4167-8dc4-c5742d99764a",
"name": "发送消息1",
"type": "n8n-nodes-base.slack",
"position": [
900,
220
],
"webhookId": "8d75cfb9-ac55-4745-b37d-013995518ff1",
"parameters": {
"text": "=🧠 *Inbox Assistant – Daily Digest* \n📅 *{{ $now.format(\"DD MMM YYYY\") }}* \n━━━━━━━━━━━━━━━━━━━\n\n{{ $json.text }}\n",
"select": "channel",
"channelId": {
"__rl": true,
"mode": "list",
"value": "C0934EF3CRM",
"cachedResultName": "daily-digest"
},
"otherOptions": {},
"authentication": "oAuth2"
},
"credentials": {
"slackOAuth2Api": {
"id": "Af5ru4q6Grpps5kG",
"name": "Slack account"
}
},
"typeVersion": 2.3
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "e2ed6dc8-752e-48cd-8ba9-c02d87ebfd88",
"connections": {
"If": {
"main": [
[
{
"node": "Send a message",
"type": "main",
"index": 0
}
],
[
{
"node": "Add label to message",
"type": "main",
"index": 0
}
]
]
},
"Code": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"Code1": {
"main": [
[
{
"node": "Code2",
"type": "main",
"index": 0
}
]
]
},
"Code2": {
"main": [
[
{
"node": "Send a message1",
"type": "main",
"index": 0
}
]
]
},
"Gmail Trigger": {
"main": [
[
{
"node": "Message a model",
"type": "main",
"index": 0
}
]
]
},
"Send a message": {
"main": [
[
{
"node": "Add label to message1",
"type": "main",
"index": 0
}
]
]
},
"Message a model": {
"main": [
[
{
"node": "Code",
"type": "main",
"index": 0
}
]
]
},
"Send a message1": {
"main": [
[]
]
},
"Schedule Trigger": {
"main": [
[
{
"node": "Get row(s) in sheet",
"type": "main",
"index": 0
}
]
]
},
"Get row(s) in sheet": {
"main": [
[
{
"node": "Code1",
"type": "main",
"index": 0
}
]
]
},
"Add label to message": {
"main": [
[
{
"node": "Append row in sheet1",
"type": "main",
"index": 0
}
]
]
},
"Add label to message1": {
"main": [
[
{
"node": "Append row in sheet",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
这是一个中级难度的工作流,适用于Ticket Management、AI Summarization等场景。适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
AI邮件助手:使用ChatGPT摘要和Slack摘要优先处理Gmail
使用Gmail、GPT-4o和Slack紧急通知的自动邮件分诊
If
Code
Wait
+5
16 节点Siddhant
Ticket Management
主动智能客户支持中心
使用GPT-4、Gmail和Trello的自动邮件支持分诊
If
Code
Gmail
+6
14 节点Marth
Ticket Management
使用 AI 分诊自动化 Google Forms 的客户支持回复
使用GPT-4o-mini AI分诊的自动化Google Forms和Gmail客户支持
If
Set
Code
+7
22 节点Daiki Takayama
Ticket Management
支持收件箱到常见问题解答回填(Gmail/Outlook)
使用GPT-4o、Gmail、Notion和Slack将支持邮件转换为常见问题解答
If
Code
Gmail
+7
21 节点Rahul Joshi
Ticket Management
AI 客户支持分流与摘要系统
使用GPT-4o、Slack和CRM集成自动处理客户支持
If
Set
Code
+10
32 节点NodeAlchemy
Ticket Management
基于AI的邮件收件箱管理器,集成GPT-4、Gmail和Slack
基于AI的邮件收件箱管理器,集成GPT-4、Gmail和Slack
If
Gmail
Slack
+5
22 节点Muhammad Bello
Ticket Management