发票提醒:Gmail到Tasks
中级
这是一个Invoice Processing, AI Summarization领域的自动化工作流,包含 13 个节点。主要使用 If, Gmail, GoogleTasks, Agent, ScheduleTrigger 等节点。 使用Gmail和Google Tasks自动检测发票并创建提醒
前置要求
- •Google 账号和 Gmail API 凭证
- •OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"name": "发票提醒:Gmail 到 Tasks",
"nodes": [
{
"id": "95eeaaed-ce70-4f9d-82aa-e67bec2a84d2",
"name": "计划触发器",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
0,
-288
],
"parameters": {
"rule": {
"interval": [
{
"field": "hours"
}
]
}
},
"typeVersion": 1.2
},
{
"id": "46df89b3-2ac9-4905-ac0a-d4bcf4dbcf9a",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"onError": "continueRegularOutput",
"position": [
448,
-288
],
"parameters": {
"text": "=You are an intelligent assistant that reads emails and determines whether the message is related to an invoice or a payment notification.\n\nYour tasks:\n1. Determine if the email is invoice-related.\n2. If yes, extract:\n - Due date (in YYYY-MM-DD format, or null)\n - Amount due (as a number, no currency symbols)\n\nAlways include these metadata values:\nId: {{ $json.id }}\nthreadId: {{ $json.threadId }}\nbody: {{ $json.text }}\nsubject: {{ $json.subject }}\nsender: {{ $json.from.value[0].name }}\n\nReturn only a valid JSON object in the format below:\n\n```json\n{\n \"is_invoice\": true or false,\n \"due_date\": \"YYYY-MM-DD\" or null,\n \"amount_due\": number or null,\n \"email_id\": \"string\",\n \"thread_id\": \"string\",\n \"sender\": \"string\",\n \"subject\": \"string\"\n}",
"options": {},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 2.1
},
{
"id": "9f3cb030-5bbb-4203-b473-84e986ab1848",
"name": "OpenAI 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
480,
-64
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o",
"cachedResultName": "gpt-4o"
},
"options": {}
},
"typeVersion": 1.2
},
{
"id": "4fcf203d-d777-4aaf-b157-64f7ddea55c5",
"name": "结构化输出解析器",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
608,
-64
],
"parameters": {
"schemaType": "manual",
"inputSchema": "{...}"
},
"typeVersion": 1.3
},
{
"id": "51db6f62-ddb6-4cb3-b33e-b1431cbe9ba2",
"name": "无操作,不执行任何操作",
"type": "n8n-nodes-base.noOp",
"position": [
1072,
-96
],
"parameters": {},
"typeVersion": 1
},
{
"id": "a6abcee9-5187-4777-a843-1d7096ac674c",
"name": "创建任务",
"type": "n8n-nodes-base.googleTasks",
"position": [
1072,
-480
],
"parameters": {
"task": "",
"title": "=Invoice from {{ $json.output.sender }} – ${{ $json.output.amount_due }} due {{ $json.output.due_date }}",
"additionalFields": {}
},
"typeVersion": 1
},
{
"id": "09aa7d30-3328-42ea-a4d5-66944b72d43a",
"name": "为邮件添加标签",
"type": "n8n-nodes-base.gmail",
"position": [
1072,
-288
],
"parameters": {
"messageId": "={{ $json.output.email_id }}",
"operation": "addLabels",
"labelNames": [
"Invoice"
]
},
"typeVersion": 2.1
},
{
"id": "7fca02d6-db42-430a-bf26-ef80f84eaee7",
"name": "标记邮件为已读",
"type": "n8n-nodes-base.gmail",
"position": [
1296,
-288
],
"parameters": {
"messageId": "={{ $json.id }}",
"operation": "markAsRead"
},
"typeVersion": 2.1
},
{
"id": "e360894f-77e8-49cb-b8ba-e2d271fd521e",
"name": "获取未读邮件",
"type": "n8n-nodes-base.gmail",
"position": [
224,
-288
],
"parameters": {
"simple": false,
"filters": {
"readStatus": "unread"
},
"options": {},
"operation": "getAll"
},
"typeVersion": 2.1
},
{
"id": "f5674f2a-6875-4b89-94f8-13fb2d2c05fd",
"name": "检查是否为发票邮件",
"type": "n8n-nodes-base.if",
"position": [
848,
-288
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "dc8158a0-29aa-4c7f-9de3-994a5d827331",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $json.output.is_invoice }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "a38b2d77-9ead-436d-ab40-12fcced60f72",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
952,
-608
],
"parameters": {
"color": 5,
"width": 336,
"height": 288,
"content": "### 💡 自定义任务格式"
},
"typeVersion": 1
},
{
"id": "2f9a2857-ebe6-4d0f-a583-af4b655e4844",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-64,
0
],
"parameters": {
"width": 304,
"height": 224,
"content": "### ⚠️ 需要设置"
},
"typeVersion": 1
},
{
"id": "6da66212-1ddb-4822-b660-70e0a94dc0b2",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-128,
-416
],
"parameters": {
"color": 5,
"width": 320,
"height": 272,
"content": "### 💡 计划触发器"
},
"typeVersion": 1
}
],
"connections": {
"AI Agent": {
"main": [
[
{
"node": "Check If Email is Invoice",
"type": "main",
"index": 0
}
]
]
},
"Schedule Trigger": {
"main": [
[
{
"node": "Get Unread Emails",
"type": "main",
"index": 0
}
]
]
},
"Get Unread Emails": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Add Label to Email": {
"main": [
[
{
"node": "Mark Email as read",
"type": "main",
"index": 0
}
]
]
},
"Structured Output Parser": {
"ai_outputParser": [
[
{
"node": "AI Agent",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"Check If Email is Invoice": {
"main": [
[
{
"node": "Add Label to Email",
"type": "main",
"index": 0
},
{
"node": "Create a task",
"type": "main",
"index": 0
}
],
[
{
"node": "No Operation, do nothing",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 发票处理, AI 摘要总结
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
我的工作流
整理 Gmail:使用 GPT-4 分类归档非活跃邮件
If
Set
Gmail
+7
13 节点Matt Chong | n8n Creator
AI 摘要总结
AI 自动保存 Gmail 收据
AI自动保存Gmail收据到Google表格和Google云端硬盘
Set
Gmail
Merge
+8
14 节点Matt Chong
发票处理
AI自动Gmail发票检测与Slack通知
使用GPT-4o从Gmail中提取发票数据并发送Slack通知
If
Gmail
Slack
+6
12 节点Matt Chong | n8n Creator
AI Gmail:优先处理您应阅读的内容
使用Gmail和GPT-4o自动分类和标记邮件
Set
Gmail
Switch
+5
17 节点Matt Chong
个人效率
23 分析客户终身价值
使用GPT-4和Bright Data MCP分析与定位高价值客户
If
Set
Code
+9
20 节点Yaron Been
市场调研
10 跟踪电子邮件营销活动表现
使用 Bright Data 和 OpenAI 自动化邮件营销活动分析与智能跟进
If
Set
Gmail
+8
17 节点Yaron Been
社交媒体