Reschedule overdue Asana tasks and clean up completed tasks
工作流概述
这是一个包含10个节点的复杂工作流,主要用于自动化处理各种任务。
工作流源代码
{
"id": "RJ4PaYq0JBr29KJm",
"meta": {
"instanceId": "e3de7ac3dee198637aeea8f82bd3b7f55121370bf7582aeef633e085d2f68ac8"
},
"name": "Reschedule overdue Asana tasks and clean up completed tasks",
"tags": [
{
"id": "oMfA3lEfbqs7MU2P",
"name": "Template",
"createdAt": "2025-01-06T20:33:18.396Z",
"updatedAt": "2025-01-06T20:33:18.396Z"
}
],
"nodes": [
{
"id": "9262720e-2beb-4426-a472-3d7bf8bc28af",
"name": "Everyday at 7am",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
80,
-520
],
"parameters": {
"rule": {
"interval": [
{
"triggerAtHour": 7
}
]
}
},
"typeVersion": 1.2
},
{
"id": "0d074451-5d61-4ed4-86a8-f6cdf002e84b",
"name": "Get user tasks",
"type": "n8n-nodes-base.asana",
"position": [
320,
-520
],
"parameters": {
"filters": {
"assignee": "1201727447190193",
"workspace": "1201727656813934",
"completed_since": "={{ DateTime.now().format('yyyy-MM-dd') }}"
},
"operation": "getAll",
"returnAll": true
},
"credentials": {
"asanaApi": {
"id": "u7fFpY0SmMcpBCdn",
"name": "Asana account"
}
},
"typeVersion": 1
},
{
"id": "14939268-9bda-4fc1-9fef-aa6a74c2365a",
"name": "Get task infos",
"type": "n8n-nodes-base.asana",
"position": [
540,
-520
],
"parameters": {
"id": "={{ $json.gid }}",
"operation": "get"
},
"credentials": {
"asanaApi": {
"id": "u7fFpY0SmMcpBCdn",
"name": "Asana account"
}
},
"typeVersion": 1
},
{
"id": "e7d9a37c-66b7-46b9-b228-7372cb0d7b09",
"name": "Task is open?",
"type": "n8n-nodes-base.if",
"position": [
780,
-520
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "145d9367-7662-4ed9-8195-bf9b35c78d6b",
"operator": {
"type": "boolean",
"operation": "false",
"singleValue": true
},
"leftValue": "={{ $json.completed }}",
"rightValue": "false"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "11ae0bbb-8d76-4623-9a24-2c2a36600dd3",
"name": "Due date in the past?",
"type": "n8n-nodes-base.if",
"position": [
1020,
-640
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "and",
"conditions": [
{
"id": "dbecabb3-8075-4cc0-94af-b678c8af8f66",
"operator": {
"type": "number",
"operation": "lt"
},
"leftValue": "={{ $json.due_on.replaceAll(\"-\",\"\") }}",
"rightValue": "={{ DateTime.now().format('yyyyMMdd') }}"
}
]
},
"looseTypeValidation": true
},
"typeVersion": 2.2
},
{
"id": "282d79c7-e74a-4249-ad37-b4d81655a206",
"name": "Set due date to Today",
"type": "n8n-nodes-base.asana",
"position": [
1280,
-680
],
"parameters": {
"id": "={{ $json.gid }}",
"operation": "update",
"otherProperties": {
"due_on": "={{ DateTime.now().format('yyyy-MM-dd') }}"
}
},
"credentials": {
"asanaApi": {
"id": "u7fFpY0SmMcpBCdn",
"name": "Asana account"
}
},
"typeVersion": 1
},
{
"id": "7cc18243-d3d4-4624-a906-a1617e411b0c",
"name": "Clean up task",
"type": "n8n-nodes-base.asana",
"position": [
1020,
-440
],
"parameters": {
"id": "={{ $json.gid }}",
"operation": "delete"
},
"credentials": {
"asanaApi": {
"id": "u7fFpY0SmMcpBCdn",
"name": "Asana account"
}
},
"typeVersion": 1
},
{
"id": "f4aafa1f-8c5b-4fd1-9aca-fd096508dbfb",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
40,
-800
],
"parameters": {
"color": 5,
"width": 640,
"height": 240,
"content": "### ⚙️ Set Up
1. Add your **Asana** credentials
2. Schedule the workflow to run at desired intervals (e.g., daily or weekly).
3. Select your **Workspace Name** and your **Assignee Name** (user) in the **Get user tasks** node
4. *(Optional) Tailor filtering conditions to match your preferred due-date rules and removal criteria.*
5. **Activate the workflow** and watch your Asana workspace stay up to date and clutter-free."
},
"typeVersion": 1
},
{
"id": "e4fcbdee-5dd0-40dc-b1ef-f7b8ce00dd03",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
60,
-360
],
"parameters": {
"color": 7,
"width": 160,
"height": 100,
"content": "👆
Update the **Scheduler** here"
},
"typeVersion": 1
},
{
"id": "195f467d-1124-4216-ab0e-048c6a9fc752",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
280,
-360
],
"parameters": {
"color": 7,
"width": 200,
"height": 100,
"content": "👆
Select your **Workspace Name** & **Assignee Name** here"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"timezone": "Europe/Paris",
"callerPolicy": "workflowsFromSameOwner",
"executionOrder": "v1"
},
"versionId": "fdc51229-75f4-4489-a7f7-1f36a35d43ac",
"connections": {
"Task is open?": {
"main": [
[
{
"node": "Due date in the past?",
"type": "main",
"index": 0
}
],
[
{
"node": "Clean up task",
"type": "main",
"index": 0
}
]
]
},
"Get task infos": {
"main": [
[
{
"node": "Task is open?",
"type": "main",
"index": 0
}
]
]
},
"Get user tasks": {
"main": [
[
{
"node": "Get task infos",
"type": "main",
"index": 0
}
]
]
},
"Everyday at 7am": {
"main": [
[
{
"node": "Get user tasks",
"type": "main",
"index": 0
}
]
]
},
"Due date in the past?": {
"main": [
[
{
"node": "Set due date to Today",
"type": "main",
"index": 0
}
]
]
}
}
}
功能特点
- 自动检测新邮件
- AI智能内容分析
- 自定义分类规则
- 批量处理能力
- 详细的处理日志
技术分析
节点类型及作用
- Scheduletrigger
- Asana
- If
- Stickynote
复杂度评估
配置难度:
维护难度:
扩展性:
实施指南
前置条件
- 有效的Gmail账户
- n8n平台访问权限
- Google API凭证
- AI分类服务订阅
配置步骤
- 在n8n中导入工作流JSON文件
- 配置Gmail节点的认证信息
- 设置AI分类器的API密钥
- 自定义分类规则和标签映射
- 测试工作流执行
- 配置定时触发器(可选)
关键参数
| 参数名称 | 默认值 | 说明 |
|---|---|---|
| maxEmails | 50 | 单次处理的最大邮件数量 |
| confidenceThreshold | 0.8 | 分类置信度阈值 |
| autoLabel | true | 是否自动添加标签 |
最佳实践
优化建议
- 定期更新AI分类模型以提高准确性
- 根据邮件量调整处理批次大小
- 设置合理的分类置信度阈值
- 定期清理过期的分类规则
安全注意事项
- 妥善保管API密钥和认证信息
- 限制工作流的访问权限
- 定期审查处理日志
- 启用双因素认证保护Gmail账户
性能优化
- 使用增量处理减少重复工作
- 缓存频繁访问的数据
- 并行处理多个邮件分类任务
- 监控系统资源使用情况
故障排除
常见问题
邮件未被正确分类
检查AI分类器的置信度阈值设置,适当降低阈值或更新训练数据。
Gmail认证失败
确认Google API凭证有效且具有正确的权限范围,重新进行OAuth授权。
调试技巧
- 启用详细日志记录查看每个步骤的执行情况
- 使用测试邮件验证分类逻辑
- 检查网络连接和API服务状态
- 逐步执行工作流定位问题节点
错误处理
工作流包含以下错误处理机制:
- 网络超时自动重试(最多3次)
- API错误记录和告警
- 处理失败邮件的隔离机制
- 异常情况下的回滚操作