使用 GPT-4o、数据表和 Gmail 跟踪每日情绪与 AI 分析报告
高级
这是一个Personal Productivity, AI Summarization领域的自动化工作流,包含 18 个节点。主要使用 Set, Code, Gmail, Webhook, DataTable 等节点。 使用 GPT-4o、数据表和 Gmail 跟踪每日情绪与 AI 分析报告
前置要求
- •Google 账号和 Gmail API 凭证
- •HTTP Webhook 端点(n8n 会自动生成)
- •OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "5935d23fce125caa8ab93af824f47776e317d824634bf7b68a810b49a4038f0a"
},
"nodes": [
{
"id": "c95623b4-57f9-4f90-96dc-545f13e3892e",
"name": "Webhook - 心情",
"type": "n8n-nodes-base.webhook",
"position": [
-640,
-256
],
"webhookId": "df6e90b9-02bc-414b-b79e-599daec19207",
"parameters": {
"path": "mood",
"options": {},
"httpMethod": "POST",
"responseMode": "responseNode"
},
"typeVersion": 2
},
{
"id": "84062798-8530-43ea-9320-cbef772f48f5",
"name": "设置心情数据",
"type": "n8n-nodes-base.set",
"position": [
-416,
-256
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "date-field",
"name": "date",
"type": "string",
"value": "={{ $now.toFormat('yyyy-MM-dd') }}"
},
{
"id": "hour-field",
"name": "hour",
"type": "string",
"value": "={{ $now.format('HH:mm') }}"
},
{
"id": "mood-field",
"name": "mood",
"type": "string",
"value": "={{ $json.body.mood }}"
},
{
"id": "note-field",
"name": "note",
"type": "string",
"value": "={{ $json.body.note }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "941ed779-8388-42fd-bee2-72dc3ce23902",
"name": "插入心情行",
"type": "n8n-nodes-base.dataTable",
"position": [
-128,
-256
],
"parameters": {
"columns": {
"value": {
"date": "={{ $('Set Mood Data').item.json.date }}",
"hour": "={{ $('Set Mood Data').item.json.hour }}",
"mood": "={{ $('Set Mood Data').item.json.mood }}",
"note": "={{ $('Set Mood Data').item.json.note }}"
},
"schema": [
{
"id": "date",
"type": "string",
"required": false,
"displayName": "date"
},
{
"id": "hour",
"type": "string",
"required": false,
"displayName": "hour"
},
{
"id": "mood",
"type": "string",
"required": false,
"displayName": "mood"
},
{
"id": "note",
"type": "string",
"required": false,
"displayName": "note"
}
],
"mappingMode": "defineBelow",
"matchingColumns": []
},
"options": {},
"dataTableId": {
"__rl": true,
"mode": "id",
"value": ""
}
},
"typeVersion": 1
},
{
"id": "7348155b-62fd-499e-ac16-1120d27683a6",
"name": "列出行 (每周)",
"type": "n8n-nodes-base.dataTable",
"position": [
-416,
32
],
"parameters": {
"operation": "get",
"returnAll": true,
"dataTableId": {
"__rl": true,
"mode": "id",
"value": ""
}
},
"typeVersion": 1
},
{
"id": "bb67d067-2f38-4c6a-b160-0892f24a081a",
"name": "聚合 (7天)",
"type": "n8n-nodes-base.code",
"position": [
-208,
32
],
"parameters": {
"jsCode": "const now = new Date();\nconst start = new Date(now.getTime() - 7*24*60*60*1000);\n\nfunction parseDate(d){ const [Y,M,D] = String(d||'').split('-').map(Number); return new Date(Y,(M-1),D); }\nconst score = m => m==='🙂'?2 : m==='😐'?1 : 0;\n\nconst rows = items.map(i=>i.json).filter(r => {\n const dt = parseDate(r.date);\n return dt && dt >= start && dt <= now;\n});\n\nconst counts = {'🙂':0,'😐':0,'😩':0};\nlet sum = 0;\nfor (const r of rows) { counts[r.mood] = (counts[r.mood]||0)+1; sum += score(r.mood); }\n\nconst n = rows.length || 1;\nconst avg = sum / n;\nconst label = avg >= 1.5 ? 'positive 🙂' : avg >= 0.75 ? 'neutral 😐' : 'low 😩';\n\n// mini-barras\nconst maxv = Math.max(counts['🙂'], counts['😐'], counts['😩'], 1);\nconst bar = v => '█'.repeat(Math.round(v ? (10 * v / maxv) : 0));\nconst chart = [\n `🙂 ${counts['🙂']} ${bar(counts['🙂'])}`,\n `😐 ${counts['😐']} ${bar(counts['😐'])}`,\n `😩 ${counts['😩']} ${bar(counts['😩'])}`,\n].join('\\n');\n\nconst summary = [\n 'Resumen semanal (últimos 7 días)',\n `Registros: ${rows.length}`,\n `Promedio: ${avg.toFixed(2)} (${label})`,\n '',\n chart\n].join('\\n');\n\nreturn [{ json: { summary, counts, avg, label, rows } }];"
},
"typeVersion": 2
},
{
"id": "04669175-8e1c-4e59-bd22-55b115a795a5",
"name": "列出行 (每月)",
"type": "n8n-nodes-base.dataTable",
"position": [
-416,
336
],
"parameters": {
"operation": "get",
"returnAll": true,
"dataTableId": {
"__rl": true,
"mode": "id",
"value": ""
}
},
"typeVersion": 1
},
{
"id": "e96febbe-fe2c-4337-b4c7-47baea124dd2",
"name": "聚合 (~30天)",
"type": "n8n-nodes-base.code",
"position": [
-208,
336
],
"parameters": {
"jsCode": "const now = new Date();\nconst start = new Date(now.getTime() - 30*24*60*60*1000);\n\nfunction parseDate(d){ const [Y,M,D] = String(d||'').split('-').map(Number); return new Date(Y,(M-1),D); }\nconst score = m => m==='🙂'?2 : m==='😐'?1 : 0;\n\nconst rows = items.map(i=>i.json).filter(r => {\n const dt = parseDate(r.date);\n return dt && dt >= start && dt <= now;\n});\n\nconst counts = {'🙂':0,'😐':0,'😩':0};\nlet sum = 0;\nfor (const r of rows) { counts[r.mood] = (counts[r.mood]||0)+1; sum += score(r.mood); }\n\nconst n = rows.length || 1;\nconst avg = sum / n;\nconst label = avg >= 1.5 ? 'positive 🙂' : avg >= 0.75 ? 'neutral 😐' : 'low 😩';\n\nconst maxv = Math.max(counts['🙂'], counts['😐'], counts['😩'], 1);\nconst bar = v => '█'.repeat(Math.round(v ? (10 * v / maxv) : 0));\nconst chart = [\n `🙂 ${counts['🙂']} ${bar(counts['🙂'])}`,\n `😐 ${counts['😐']} ${bar(counts['😐'])}`,\n `😩 ${counts['😩']} ${bar(counts['😩'])}`,\n].join('\\n');\n\nconst summary = [\n 'Resumen mensual (últimos ~30 días)',\n `Registros: ${rows.length}`,\n `Promedio: ${avg.toFixed(2)} (${label})`,\n '',\n chart\n].join('\\n');\n\nreturn [{ json: { summary, counts, avg, label, rows } }];"
},
"typeVersion": 2
},
{
"id": "7221f78e-7303-42bb-a4f2-c49a472c989f",
"name": "便签 - 记录",
"type": "n8n-nodes-base.stickyNote",
"position": [
-704,
-368
],
"parameters": {
"color": 4,
"width": 1120,
"height": 280,
"content": "## 心情日志"
},
"typeVersion": 1
},
{
"id": "4ffe2f6a-1ea9-429a-9c3a-70f377246a95",
"name": "便签 - 每周",
"type": "n8n-nodes-base.stickyNote",
"position": [
-704,
-64
],
"parameters": {
"color": 5,
"width": 1120,
"height": 280,
"content": "## 每周摘要"
},
"typeVersion": 1
},
{
"id": "ae23549f-9342-4b82-86cb-c5c59b13de5c",
"name": "便签 - 每月",
"type": "n8n-nodes-base.stickyNote",
"position": [
-704,
240
],
"parameters": {
"color": 6,
"width": 1120,
"height": 280,
"content": "## 每月摘要"
},
"typeVersion": 1
},
{
"id": "9eea882b-927d-4935-b5b8-b94c04f4a0ad",
"name": "发送最终回复2",
"type": "n8n-nodes-base.respondToWebhook",
"position": [
176,
-256
],
"parameters": {
"options": {},
"respondWith": "json",
"responseBody": "={{ {\"message\": \"Emotional state saved. Come back tomorrow 👌\"} }}"
},
"typeVersion": 1.1
},
{
"id": "f45adf5f-4f2b-43c7-8c28-748bfa3d3973",
"name": "每周计划 (周日 20:00)",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
-640,
32
],
"parameters": {
"rule": {
"interval": [
{
"field": "weeks",
"triggerAtDay": [],
"triggerAtHour": 20
}
]
}
},
"typeVersion": 1.2
},
{
"id": "3c0fa2c0-e20e-4dc3-8946-8abc92d7473f",
"name": "每月计划 (1号 08:00)",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
-640,
336
],
"parameters": {
"rule": {
"interval": [
{
"field": "months",
"triggerAtHour": 8
}
]
}
},
"typeVersion": 1.2
},
{
"id": "6bce607d-5319-4b14-af97-765bcd74280c",
"name": "ChatGPT 每周分析",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
-48,
32
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o"
},
"options": {},
"messages": {
"values": [
{
"content": "=Analyze these moods from the past 7 days and generate a summary with trends, potential triggers (based on 'note'), and 3 actionable recommendations. Keep it short and sweet.\n\n{{ $json.summary }}\n\nFull data:\n{{ JSON.stringify($json.rows) }}"
}
]
}
},
"credentials": {
"openAiApi": {
"id": "sGgf9jkDln4JRKOD",
"name": "OpenAi account"
}
},
"typeVersion": 1.8
},
{
"id": "d55980d6-cdae-414e-8b4b-e38e3c0cfa12",
"name": "ChatGPT 每月分析",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
-48,
336
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o"
},
"options": {},
"messages": {
"values": [
{
"content": "=Analyze my moods from the past month. Summarize trends, notable days/times, correlations between 'note' and mood, and 3 specific habits to try this month. Be specific.\n\n{{ $json.summary }}\n\nFull data:\n{{ JSON.stringify($json.rows) }}"
}
]
}
},
"credentials": {
"openAiApi": {
"id": "sGgf9jkDln4JRKOD",
"name": "OpenAi account"
}
},
"typeVersion": 1.8
},
{
"id": "30ad84b4-7bb0-4258-a6ff-eed7c9862c8e",
"name": "Gmail (每周)",
"type": "n8n-nodes-base.gmail",
"position": [
256,
32
],
"webhookId": "32991112-ac8a-4a58-a24f-c9ca318134d4",
"parameters": {
"sendTo": "your.email@example.com",
"message": "=Automatic summary (text + graphic):\n\n{{ $('Aggregate (7d)').item.json.summary }}\n\n---\n\nAI Analysis:\n\n{{ $json.message.content }}",
"options": {},
"subject": "Weekly Mood Summary"
},
"credentials": {
"gmailOAuth2": {
"id": "iVfmUSbPyEaMxofu",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "17a60bc3-02f1-402b-8971-9a0de69982a6",
"name": "Gmail (每月)",
"type": "n8n-nodes-base.gmail",
"position": [
256,
336
],
"webhookId": "a04cc33d-2c4b-494d-8723-2c528f91a4a9",
"parameters": {
"sendTo": "your.email@example.com",
"message": "=Automatic summary (text + graphic):\n\n{{ $('Aggregate (~30d)').item.json.summary }}\n\n---\n\nAI Analysis:\n\n{{ $json.message.content }}",
"options": {},
"subject": "Monthly Mood Summary"
},
"credentials": {
"gmailOAuth2": {
"id": "iVfmUSbPyEaMxofu",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "f595c545-2c3f-4aa1-8902-da8052702bfc",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1328,
-288
],
"parameters": {
"width": 544,
"height": 144,
"content": "## 心情日志"
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"Set Mood Data": {
"main": [
[
{
"node": "Insert Mood Row",
"type": "main",
"index": 0
}
]
]
},
"Aggregate (7d)": {
"main": [
[
{
"node": "ChatGPT Weekly Analysis",
"type": "main",
"index": 0
}
]
]
},
"Webhook - Mood": {
"main": [
[
{
"node": "Set Mood Data",
"type": "main",
"index": 0
}
]
]
},
"Insert Mood Row": {
"main": [
[
{
"node": "Respond to Webhook1",
"type": "main",
"index": 0
}
]
]
},
"Aggregate (~30d)": {
"main": [
[
{
"node": "ChatGPT Monthly Analysis",
"type": "main",
"index": 0
}
]
]
},
"List Rows (Weekly)": {
"main": [
[
{
"node": "Aggregate (7d)",
"type": "main",
"index": 0
}
]
]
},
"List Rows (Monthly)": {
"main": [
[
{
"node": "Aggregate (~30d)",
"type": "main",
"index": 0
}
]
]
},
"ChatGPT Weekly Analysis": {
"main": [
[
{
"node": "Gmail (Weekly)",
"type": "main",
"index": 0
}
]
]
},
"ChatGPT Monthly Analysis": {
"main": [
[
{
"node": "Gmail (Monthly)",
"type": "main",
"index": 0
}
]
]
},
"Schedule Monthly (1th, 08:00)": {
"main": [
[
{
"node": "List Rows (Monthly)",
"type": "main",
"index": 0
}
]
]
},
"Schedule Weekly (SUNDAY 20:00)": {
"main": [
[
{
"node": "List Rows (Weekly)",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 个人效率, AI 摘要总结
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
员工时间追踪系统(含GPT-4o报告和Gmail通知)
员工时间追踪系统,包含GPT-4o报告和Gmail通知功能
If
Set
Gmail
+7
33 节点Jose Castillo
人力资源
工作日日志记录
AI工时表生成器 - 集成Gmail、日历和GitHub到Google表格
If
Set
Code
+11
31 节点Luka Zivkovic
个人效率
国家气象局AI分析
基于NWS警报、雷达图像和Home Assistant的AI生成天气分析
Set
Code
Merge
+10
20 节点Carl Danley
个人效率
发送定时n8n发布说明通知到Gmail
基于AI的n8n发布说明摘要通知(通过Gmail与GPT-5-Mini)
Set
Code
Html
+7
16 节点Jeff Huera
个人效率
使用 Mistral AI、LinkedIn 和 Google Sheets 自动化职位搜索与简历定制
使用 Mistral AI、LinkedIn 和 Google Sheets 自动化职位搜索与简历定制
Set
Code
Html
+18
46 节点Jordan Hoyle
个人效率
带有 AI 摘要的每日邮件摘要
使用 OpenAI O4-Mini 从 Gmail 标签创建 AI 摘要的邮件摘要
If
Set
Code
+8
16 节点German Velibekov
个人效率
工作流信息
难度等级
高级
节点数量18
分类2
节点类型9
作者
Jose Castillo
@j4ssn3oAutomation & Growth Engineer | Founder of Automation Hub I build practical, AI-powered workflows that help creators and businesses automate daily tasks, track performance, and make smarter decisions — all without code. Passionate about turning complex systems into simple, scalable automations.
外部链接
在 n8n.io 查看 →
分享此工作流