每日邮件摘要和总结机器人
中级
这是一个自动化工作流,包含 14 个节点。主要使用 If, Code, Gmail, Slack, Aggregate 等节点。 从Gmail到Slack的自动邮件摘要,含GPT-4o总结
前置要求
- •Google 账号和 Gmail API 凭证
- •Slack Bot Token 或 Webhook URL
使用的节点 (14)
分类
-
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "pjLIqJYyE8diFDeq",
"meta": {
"instanceId": "7036f994fcf077f382ea0edc134b49e1ce0556fa914b12051651961e7fbc3600",
"templateCredsSetupCompleted": true
},
"name": "每日邮件摘要和总结机器人",
"tags": [],
"nodes": [
{
"id": "b098a164-6c8a-4d51-9876-cfbde2e5da76",
"name": "计划触发器",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
-32,
272
],
"parameters": {
"rule": {
"interval": [
{
"field": "cronExpression",
"expression": "0 0 8 * * *"
}
]
}
},
"typeVersion": 1.2
},
{
"id": "2aa30690-0b1b-49eb-bae4-eb3c48bc840c",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-96,
-80
],
"parameters": {
"height": 304,
"content": "## 每日邮件摘要工作流"
},
"typeVersion": 1
},
{
"id": "90dcdae6-5d2b-496f-8774-ee8d377bbd5a",
"name": "Gmail - 获取昨天的邮件",
"type": "n8n-nodes-base.gmail",
"position": [
192,
272
],
"webhookId": "98420742-a7f3-4dde-8070-95c939a516a2",
"parameters": {
"filters": {
"receivedAfter": "={{ $now.minus({days: 1}).startOf('day').toISO() }}",
"receivedBefore": "={{ $now.startOf('day').toISO() }}"
},
"operation": "getAll"
},
"typeVersion": 2.1
},
{
"id": "96501595-c231-4d53-b028-cbe0915b0a5c",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
128,
464
],
"parameters": {
"color": 7,
"height": 256,
"content": "## Gmail 配置"
},
"typeVersion": 1
},
{
"id": "5fa53f71-b724-489b-8492-767fdd972a26",
"name": "AI Agent - 分析邮件",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
864,
176
],
"parameters": {
"text": "=Analyze these emails from yesterday and create a concise daily digest summary:\n\nEmails to analyze:\n{{ JSON.stringify($json) }}\n\nCreate a structured summary that includes:\n1. Total number of emails received\n2. Important/urgent emails (if any)\n3. Key messages grouped by sender or topic\n4. Action items or requests that need attention\n5. Brief overview of main topics discussed\n\nFormat the output as a clean, readable summary suitable for Slack.",
"options": {
"systemMessage": "You are an intelligent email assistant that analyzes emails and creates concise, well-organized daily digest summaries. Focus on extracting the most important information, action items, and key messages. Group related emails together and highlight urgent matters. Keep the summary concise but comprehensive."
},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 2
},
{
"id": "888291d6-3791-4a85-bfba-39d00acced61",
"name": "OpenRouter聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
"position": [
864,
400
],
"parameters": {
"model": "openai/gpt-4o-mini",
"options": {
"maxTokens": 2000,
"temperature": 0.3
}
},
"typeVersion": 1
},
{
"id": "23577fe9-3338-4167-9edf-0acc4a77c5a0",
"name": "结构化输出解析器",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
1008,
400
],
"parameters": {
"schemaType": "manual",
"inputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"summary\": {\n \"type\": \"string\",\n \"description\": \"The complete daily email digest summary formatted for Slack\"\n },\n \"emailCount\": {\n \"type\": \"number\",\n \"description\": \"Total number of emails analyzed\"\n },\n \"urgentItems\": {\n \"type\": \"array\",\n \"description\": \"List of urgent or important items\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"actionItems\": {\n \"type\": \"array\",\n \"description\": \"List of action items or tasks\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n },\n \"required\": [\"summary\", \"emailCount\"]\n}"
},
"typeVersion": 1.2
},
{
"id": "d0ad860d-14d4-47f2-afef-4922e3bdf53e",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
864,
560
],
"parameters": {
"color": 7,
"height": 240,
"content": "## AI 处理"
},
"typeVersion": 1
},
{
"id": "ec852ebf-1b9a-43a5-90c1-9f972bc101ad",
"name": "Slack 格式化",
"type": "n8n-nodes-base.code",
"position": [
1216,
176
],
"parameters": {
"jsCode": "// Format the AI summary for Slack\nconst output = $input.first().json.output;\nconst today = new Date().toLocaleDateString('en-US', { \n weekday: 'long', \n year: 'numeric', \n month: 'long', \n day: 'numeric' \n});\n\nlet slackMessage = `:email: *Daily Email Digest for ${today}*\\n\\n`;\nslackMessage += `*Total Emails Analyzed:* ${output.emailCount}\\n\\n`;\n\nif (output.urgentItems && output.urgentItems.length > 0) {\n slackMessage += `:warning: *Urgent Items:*\\n`;\n output.urgentItems.forEach(item => {\n slackMessage += `• ${item}\\n`;\n });\n slackMessage += `\\n`;\n}\n\nif (output.actionItems && output.actionItems.length > 0) {\n slackMessage += `:clipboard: *Action Items:*\\n`;\n output.actionItems.forEach(item => {\n slackMessage += `• ${item}\\n`;\n });\n slackMessage += `\\n`;\n}\n\nslackMessage += `:memo: *Summary:*\\n${output.summary}`;\n\nreturn {\n message: slackMessage,\n emailCount: output.emailCount\n};"
},
"typeVersion": 2
},
{
"id": "1e20a30b-a265-47ac-850a-1b4ff962e271",
"name": "Slack - 发送摘要",
"type": "n8n-nodes-base.slack",
"position": [
1440,
176
],
"webhookId": "970ab742-56bc-451d-9e29-85971c4d5328",
"parameters": {
"text": "={{ $json.message }}",
"select": "channel",
"channelId": {
"__rl": true,
"mode": "list",
"value": "C09L12N8F45",
"cachedResultName": "test"
},
"otherOptions": {},
"authentication": "oAuth2"
},
"typeVersion": 2.2
},
{
"id": "4f1132de-0ac8-49e1-a0c5-a4dbff364a08",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1376,
336
],
"parameters": {
"color": 7,
"height": 352,
"content": "## Slack 配置"
},
"typeVersion": 1
},
{
"id": "b116a4a7-eb4d-43c7-99ef-f0f55d985273",
"name": "项目列表",
"type": "n8n-nodes-base.aggregate",
"position": [
640,
176
],
"parameters": {
"options": {},
"aggregate": "aggregateAllItemData"
},
"typeVersion": 1
},
{
"id": "ccf5813b-4e0c-476c-99df-fae172256d3c",
"name": "如果",
"type": "n8n-nodes-base.if",
"position": [
416,
272
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "ee3a0b33-70b2-482a-9d3b-3dfe751952e8",
"operator": {
"type": "number",
"operation": "gt"
},
"leftValue": "={{ $items().length }}",
"rightValue": 0
}
]
}
},
"typeVersion": 2.2
},
{
"id": "eb88744e-7214-4c49-975e-525d0bf3614b",
"name": "Slack - 无邮件",
"type": "n8n-nodes-base.slack",
"position": [
640,
368
],
"webhookId": "4f76c067-fbbd-4527-956c-72778225a4a7",
"parameters": {
"text": "=*:email: Daily Email Digest — No emails*\nTarget date (JST): {{$now.setZone('Asia/Tokyo').minus({days:1}).toFormat('yyyy-LL-dd (ccc)')}}\nNo emails were found for yesterday. The next digest will run as scheduled.",
"select": "channel",
"channelId": {
"__rl": true,
"mode": "list",
"value": "C09L12N8F45",
"cachedResultName": "test"
},
"otherOptions": {},
"authentication": "oAuth2"
},
"typeVersion": 2.3
}
],
"active": false,
"pinData": {},
"settings": {
"callerPolicy": "workflowsFromSameOwner",
"errorWorkflow": "E2fdCmZVIRZ1HURh",
"executionOrder": "v1"
},
"versionId": "3509e277-92f9-4748-8272-2ff915f900c6",
"connections": {
"If": {
"main": [
[
{
"node": "Item Lists",
"type": "main",
"index": 0
}
],
[
{
"node": "Slack - No Emails",
"type": "main",
"index": 0
}
]
]
},
"Item Lists": {
"main": [
[
{
"node": "AI Agent - Analyze Emails",
"type": "main",
"index": 0
}
]
]
},
"Format for Slack": {
"main": [
[
{
"node": "Slack - Send Summary",
"type": "main",
"index": 0
}
]
]
},
"Schedule Trigger": {
"main": [
[
{
"node": "Gmail - Get Yesterday's Emails",
"type": "main",
"index": 0
}
]
]
},
"OpenRouter Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent - Analyze Emails",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Structured Output Parser": {
"ai_outputParser": [
[
{
"node": "AI Agent - Analyze Emails",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"AI Agent - Analyze Emails": {
"main": [
[
{
"node": "Format for Slack",
"type": "main",
"index": 0
}
]
]
},
"Gmail - Get Yesterday's Emails": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
自动化会议准备
使用 GPT-5 和 Gemini 研究从日历到 Slack 通过 Attio CRM 自动准备会议
If
Set
Code
+16
39 节点Harry Siggins
AI 摘要总结
使用Gemini、Slack和Notion从新闻简报创建AI情报摘要
使用Gemini、Slack和Notion从新闻简报创建AI情报摘要
Set
Code
Gmail
+12
19 节点Harry Siggins
杂项
基于AI的会议研究与每日议程(Google日历、Attio CRM和Slack)
基于AI的会议研究与每日议程:使用Google日历、Attio CRM和Slack
If
Set
Code
+15
30 节点Harry Siggins
AI 摘要总结
自动化X(Twitter)内容引擎
基于AI的X(Twitter)内容生成与调度(LangChain和Blotato)
If
Code
Gmail
+8
24 节点YUSUKE YAMAMOTO
使用 Slack、Gmail 和 AI 自动化 Jira 待办事项整理和报告
通过 Slack、Gmail 和 GPT-4 实现 Jira 待办事项整理与报告的自动化
If
Set
Jira
+9
31 节点Rahul Joshi
使用Perplexity和GPT为WordPress创建SEO优化博客,包含关键词和媒体
使用Perplexity和GPT为WordPress创建SEO优化博客,包含关键词和媒体
Set
Code
Limit
+22
124 节点Paul
内容创作