自动归档 Gmail 收件箱邮件
中级
这是一个Other领域的自动化工作流,包含 10 个节点。主要使用 Gmail, Filter, ItemLists, ScheduleTrigger 等节点。 自动归档 Gmail 收件箱邮件
前置要求
- •Google 账号和 Gmail API 凭证
分类
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"nodes": [
{
"id": "b1afd02d-6edf-4540-bf32-09d87cb8a27b",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
320,
220
],
"parameters": {
"color": 5,
"width": 379,
"height": 80,
"content": "### 👨🎤 设置"
},
"typeVersion": 1
},
{
"id": "3481e6c3-7706-4c7f-8ca6-c96f76d82021",
"name": "每个工作日的午夜",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
400,
340
],
"parameters": {
"rule": {
"interval": [
{
"field": "cronExpression",
"expression": "0 0 * * 1-5"
}
]
}
},
"typeVersion": 1
},
{
"id": "3c74e4fd-e919-4acb-8092-658f2e71513b",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
380,
520
],
"parameters": {
"color": 7,
"width": 202,
"height": 100,
"content": "👆 设置您的计划。我将其用于工作电子邮件。对于个人电子邮件,我每天运行此操作。"
},
"typeVersion": 1
},
{
"id": "de421702-d012-4ea1-826e-1a4756ff4856",
"name": "获取最近一天的所有电子邮件",
"type": "n8n-nodes-base.gmail",
"position": [
620,
340
],
"parameters": {
"filters": {
"q": "label:inbox",
"receivedBefore": "={{ $now.minus({days: 1}) }}"
},
"resource": "thread",
"returnAll": true
},
"credentials": {
"gmailOAuth2": {
"id": "8",
"name": "Work Gmail account"
}
},
"retryOnFail": true,
"typeVersion": 2
},
{
"id": "ef43b756-5f9c-4c8d-830a-8ccb71562618",
"name": "获取每封电子邮件的线程",
"type": "n8n-nodes-base.gmail",
"position": [
840,
340
],
"parameters": {
"options": {},
"resource": "thread",
"threadId": "={{ $json.id }}",
"operation": "get"
},
"credentials": {
"gmailOAuth2": {
"id": "8",
"name": "Work Gmail account"
}
},
"retryOnFail": true,
"typeVersion": 2
},
{
"id": "bfc3b7e1-651a-4eb5-8882-b21d120d982b",
"name": "仅保留收件箱中加星标的电子邮件",
"type": "n8n-nodes-base.filter",
"position": [
1060,
340
],
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{ JSON.stringify($json.messages).includes('STARRED') }}"
}
]
}
},
"typeVersion": 1
},
{
"id": "3d8145dc-577d-4e9b-83a7-fdf06afa1b96",
"name": "对于线程中的每条消息",
"type": "n8n-nodes-base.itemLists",
"position": [
1480,
520
],
"parameters": {
"options": {},
"fieldToSplitOut": "messages"
},
"typeVersion": 2
},
{
"id": "1a9083a8-ffd2-403e-bf53-9b9eee87ff5b",
"name": "归档消息(从收件箱中移除)",
"type": "n8n-nodes-base.gmail",
"position": [
1700,
520
],
"parameters": {
"labelIds": "=INBOX",
"messageId": "={{ $json.id }}",
"operation": "removeLabels"
},
"credentials": {
"gmailOAuth2": {
"id": "8",
"name": "Work Gmail account"
}
},
"retryOnFail": true,
"typeVersion": 2
},
{
"id": "c51240d0-88cb-461b-82ba-929a2d8a9dde",
"name": "归档线程(从收件箱中移除)",
"type": "n8n-nodes-base.gmail",
"position": [
1340,
300
],
"parameters": {
"labelIds": "=INBOX",
"resource": "thread",
"threadId": "={{ $json.id }}",
"operation": "removeLabels"
},
"credentials": {
"gmailOAuth2": {
"id": "8",
"name": "Work Gmail account"
}
},
"retryOnFail": true,
"typeVersion": 2
},
{
"id": "3ca7074f-c912-456c-92e4-08cac8833471",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
1060,
520
],
"parameters": {
"color": 7,
"width": 202,
"height": 100,
"content": "⭐ 将加星标的电子邮件保留在收件箱中.. 归档其他所有内容!"
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"At midnight every work day": {
"main": [
[
{
"node": "Get all emails in the last day",
"type": "main",
"index": 0
}
]
]
},
"Get the thread of each email": {
"main": [
[
{
"node": "Keep only starred emails in inbox",
"type": "main",
"index": 0
}
]
]
},
"Get all emails in the last day": {
"main": [
[
{
"node": "Get the thread of each email",
"type": "main",
"index": 0
}
]
]
},
"for each message in the thread": {
"main": [
[
{
"node": "Archive message (remove from inbox)",
"type": "main",
"index": 0
}
]
]
},
"Keep only starred emails in inbox": {
"main": [
[
{
"node": "Archive thread (remove from inbox)",
"type": "main",
"index": 0
},
{
"node": "for each message in the thread",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 其他
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
在 Todoist 中自动创建每日待办事项列表
在 Todoist 中自动创建每日待办事项列表
If
Code
Filter
+3
13 节点Mutasem
其他
任意RSS源转邮件
将任意RSS源转换为邮件
If
Set
Gmail
+6
10 节点Mutasem
其他
直接在 Notion 数据库中自动记录 n8n 工作流
直接在 Notion 数据库中自动记录 n8n 工作流
If
N8n
Set
+4
10 节点Mutasem
其他
使用Gmail、Google Sheets和AI自动分类邮件
使用Gmail、Google Sheets和AI自动分类邮件
Set
Gmail
Filter
+6
17 节点Milan Vasarhelyi
其他
在可视化参考库中探索n8n节点
在可视化参考库中探索n8n节点
If
Ftp
Set
+93
113 节点I versus AI
其他
为您的电子邮件生成可视化摘要和知识图谱洞察
为您的电子邮件生成可视化摘要和知识图谱洞察
If
Set
Code
+13
38 节点InfraNodus
其他