每日定时邮件推送
中级
这是一个Other, AI领域的自动化工作流,包含 12 个节点。主要使用 Code, Gmail, Aggregate, Agent, ScheduleTrigger 等节点,结合人工智能技术实现智能自动化。 使用 GPT-4o 和 Gmail 的自动化每日邮件分析与摘要
前置要求
- •Google 账号和 Gmail API 凭证
- •OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "Ucu10DYuMwYdLLVk",
"meta": {
"instanceId": "159ec2e1d690fe685084d28de8ca73848642bf563457a19b94cfc00f23a0d9a9",
"templateCredsSetupCompleted": true
},
"name": "每日定时邮件推送",
"tags": [],
"nodes": [
{
"id": "908a85db-7b15-4ece-8dab-19398e0c1871",
"name": "计划触发器",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
-80,
-80
],
"parameters": {
"rule": {
"interval": [
{
"triggerAtHour": 18
}
]
}
},
"typeVersion": 1.2
},
{
"id": "8cadc5e6-193e-42e9-b2fc-54a2025191c2",
"name": "Gmail",
"type": "n8n-nodes-base.gmail",
"position": [
360,
-80
],
"webhookId": "6fbdcf54-7d41-4fb0-aa17-07edb33cd5d0",
"parameters": {
"simple": false,
"filters": {
"receivedAfter": "={{ $json.today}}",
"receivedBefore": "={{ $json.tomorrow }}"
},
"options": {},
"operation": "getAll"
},
"credentials": {
"gmailOAuth2": {
"id": "gUrhTlOlNSEw7OKA",
"name": "Gmail account"
}
},
"typeVersion": 2.1,
"alwaysOutputData": true
},
{
"id": "62ab4e36-b42f-4aff-8ec5-4456f4827ca3",
"name": "日期转换器",
"type": "n8n-nodes-base.code",
"position": [
140,
-80
],
"parameters": {
"jsCode": "const now = new Date();\nconst today = new Date(now.getFullYear(), now.getMonth(), now.getDate());\nconst tomorrow = new Date(today);\ntomorrow.setDate(today.getDate() + 1);\n\nconst isoDate = (d) => d.toISOString().split('.')[0] + 'Z';\n\nreturn [\n {\n json: {\n today: isoDate(today),\n tomorrow: isoDate(tomorrow),\n },\n },\n];\n"
},
"typeVersion": 2
},
{
"id": "c25a964f-6d41-4c97-b90f-f5ce15cadaa7",
"name": "AI 代理",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
1020,
160
],
"parameters": {
"text": "You are an AI Chief of Staff for a small business owner. Your job is to review a day’s worth of emails, texts, and calls and produce a concise, structured summary that helps them stay focused and effective.\n\nYou must only surface tasks, people, and opportunities that appear in the message content. Do not invent next steps, leads, or strategy notes.\n\nIf a section has no relevant content, leave it out entirely. It’s better to report nothing than to guess.",
"options": {
"systemMessage": "=Below is a transcript of today’s messages — including email, text, and call summaries.\n\nAnalyze the content and generate a markdown-formatted **Daily Business Pulse**, using only what appears in the messages. Do not assume, extrapolate, or fabricate any details.\n\nMessages:\n{{ $json.combinedText }}\n\nUse the structure below. Omit any section that has no relevant content.\n\n---\n\n👋 **Here’s what matters from your day**\n\n---\n\n📝 **Open Loops / Pending Follow-Ups** \n_List any conversations that require a response or action._\n\n---\n\n🚀 **Next Steps You've Committed To** \n_List anything the user said they would do._\n\n---\n\n🧲 **Leads or Conversations Worth Following Up On** \n_Only include if the person expressed interest or asked for help._\n\n---\n\n🛑 **Conversations That Aren’t Leading Anywhere** \n_Include if there are back-and-forths with no progress, spam, or promotional threads._\n\n---\n\n🧠 **Strategy Notes** \n_Only add notes if there are clear, recurring themes or opportunities based on the content._\n\n---\n\n✅ **Top 3 Tasks for Tomorrow** \n_If tasks were mentioned and clearly matter, list the top 3. Otherwise, leave this out._"
},
"promptType": "define"
},
"typeVersion": 2
},
{
"id": "fe2552ce-48be-44bd-b975-cde379b46b51",
"name": "OpenAI 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
1020,
360
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "qiPWoGhtEMQi7AWs",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "d2410164-fde8-46f1-8df1-6cbf3874d397",
"name": "聚合",
"type": "n8n-nodes-base.aggregate",
"position": [
580,
60
],
"parameters": {
"options": {},
"fieldsToAggregate": {
"fieldToAggregate": [
{
"fieldToAggregate": "headers.from"
},
{
"fieldToAggregate": "headers.subject"
},
{
"fieldToAggregate": "text"
}
]
}
},
"typeVersion": 1
},
{
"id": "9c3c28f5-35d5-4164-a694-8a9bc26354d5",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-120,
-120
],
"parameters": {
"color": 4,
"width": 620,
"height": 200,
"content": "确保您的表名与实际知识库结构匹配"
},
"typeVersion": 1
},
{
"id": "476d2f5a-c0da-4683-89a2-9cbe9d93c638",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
520,
40
],
"parameters": {
"color": 6,
"width": 420,
"content": "确保您的表名与实际知识库结构匹配"
},
"typeVersion": 1
},
{
"id": "f9301bfa-2cd7-4eaf-9798-729604a6b49a",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
980,
140
],
"parameters": {
"width": 540,
"content": "确保您的表名与实际知识库结构匹配"
},
"typeVersion": 1
},
{
"id": "5cdda71c-ba41-41ba-aae1-66d39caf75c9",
"name": "邮箱清理",
"type": "n8n-nodes-base.code",
"position": [
780,
60
],
"parameters": {
"jsCode": "const cleanMessages = items.map(item => {\n const from = item.json.header?.from || \"Unknown sender\";\n const subject = item.json.header?.subject || \"No subject\";\n const rawBody = item.json.text || \"\"; // fall back to empty string\n const body = String(rawBody); // ensure it's a string\n\n const cleaned = body\n .replace(/<\\/?[^>]+(>|$)/g, \"\") // Remove HTML\n .replace(/(Unsubscribe|View in browser)/gi, \"\") // Strip only promo triggers\n .replace(/\\n{3,}/g, \"\\n\\n\") // Collapse excess breaks\n .trim(); // Clean up\n\n return `📩 **From:** ${from}\\n**Subject:** ${subject}\\n**Preview:**\\n${cleaned}\\n\\n---\\n`;\n});\n\nreturn [{\n json: {\n combinedText: cleanMessages.join('\\n')\n }\n}];"
},
"typeVersion": 2
},
{
"id": "0807cef5-876f-433d-a94a-2db7f86d844d",
"name": "格式化 HTML",
"type": "n8n-nodes-base.code",
"position": [
1380,
160
],
"parameters": {
"jsCode": "const markdown = $input.all().map((item) => item.json.output);\nlet html = markdown.map((md) =>\n md\n .replace(/(\\*\\*|__)(.*?)\\1/g, \"<b>$2</b>\")\n .replace(/(\\*|_)(.*?)\\1/g, \"<i>$2</i>\")\n .replace(/~~(.*?)~~/g, \"<del>$1</del>\")\n .replace(/`([^`\\n]+)`/g, \"<code>$1</code>\")\n .replace(/!\\[([^\\]]+)\\]\\(([^\\)]+)\\)/g, '<img src=\"$2\" alt=\"$1\">')\n .replace(/\\[([^\\]]+)\\]\\(([^\\)]+)\\)/g, '<a href=\"$2\">$1</a>')\n .replace(/(\\r\\n|\\n|\\r)/gm, \"<br>\"),\n);\n\nreturn { html };\n"
},
"typeVersion": 2
},
{
"id": "bfc39659-9e36-4dde-9536-558d491f965c",
"name": "发送消息",
"type": "n8n-nodes-base.gmail",
"position": [
1580,
320
],
"webhookId": "39d8fc4a-0fa4-4a13-a123-2f1373787a79",
"parameters": {
"sendTo": "zawagner@gmail.com",
"message": "={{ $json.html[0] }}",
"options": {},
"subject": "Here's Your Daily Pulse"
},
"credentials": {
"gmailOAuth2": {
"id": "gUrhTlOlNSEw7OKA",
"name": "Gmail account"
}
},
"typeVersion": 2.1
}
],
"active": true,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "fa9af357-4a58-4540-94d4-7228678ea75b",
"connections": {
"Gmail": {
"main": [
[
{
"node": "Aggregate",
"type": "main",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "Format HTML",
"type": "main",
"index": 0
}
]
]
},
"Aggregate": {
"main": [
[
{
"node": "Email Cleanup",
"type": "main",
"index": 0
}
]
]
},
"Format HTML": {
"main": [
[
{
"node": "Send Message",
"type": "main",
"index": 0
}
]
]
},
"Email Cleanup": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"Date Transformer": {
"main": [
[
{
"node": "Gmail",
"type": "main",
"index": 0
}
]
]
},
"Schedule Trigger": {
"main": [
[
{
"node": "Date Transformer",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 其他, 人工智能
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
AI 代理餐厅 [模板]
🤖 WhatsApp、Instagram 和 Messenger 的 AI 餐厅助手
If
N8n
Set
+37
239 节点Amanda Benks
其他
MailChimp自动化
基于AI的餐厅通讯生成器,集成Mailchimp和Telegram审批
If
Set
Code
+16
43 节点Femi Ad
人工智能
自动化博客撰写与社交媒体推广代理
使用GPT-4、Perplexity和WordPress自动化SEO博客创建+社交媒体
Set
Code
Gmail
+21
79 节点LukaszB
设计
敏捷团队冲刺规划自动化
使用OpenAI、Google日历和Gmail为敏捷团队自动化冲刺规划
If
Set
Code
+17
52 节点Willemijn
产品
在可视化参考库中探索n8n节点
在可视化参考库中探索n8n节点
If
Ftp
Set
+93
113 节点I versus AI
其他
标记接收邮件,构建知识图谱,通过Telegram通知
使用Gemini AI自动化Gmail标记并构建InfraNodus知识图谱,通过Telegram发送提醒
Code
Wait
Gmail
+8
28 节点InfraNodus
其他