AI驱动的税务截止日期提醒与合规警报(会计用)
这是一个Document Extraction, AI Summarization领域的自动化工作流,包含 19 个节点。主要使用 If, Code, Slack, EmailSend, HttpRequest 等节点。 使用GPT-4、Google Sheets和Slack的税务截止日期管理与合规警报
- •Slack Bot Token 或 Webhook URL
- •可能需要目标 API 的认证凭证
- •Google Sheets API 凭证
{
"id": "hZXFMMh3gVl4u3K4",
"meta": {
"instanceId": "dd69efaf8212c74ad206700d104739d3329588a6f3f8381a46a481f34c9cc281",
"templateCredsSetupCompleted": true
},
"name": "AI 驱动的税务截止日期提醒与合规警报(会计用)",
"tags": [],
"nodes": [
{
"id": "ec99697c-9837-4945-8743-ad1099286938",
"name": "每日税务检查",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
-2752,
2336
],
"parameters": {
"rule": {
"interval": [
{}
]
}
},
"typeVersion": 1.2
},
{
"id": "566f5199-04e1-4bb4-9fb3-19eab294368a",
"name": "获取税务日历",
"type": "n8n-nodes-base.googleSheets",
"position": [
-2528,
2240
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "name",
"value": "TaxCalendar"
},
"documentId": {
"__rl": true,
"mode": "id",
"value": "YOUR_TAX_CALENDAR_ID"
},
"authentication": "serviceAccount"
},
"credentials": {
"googleApi": {
"id": "ScSS2KxGQULuPtdy",
"name": "Google Sheets- test"
}
},
"typeVersion": 4.2
},
{
"id": "9f0f080c-568d-4145-a82f-39bf2849d72e",
"name": "获取公司配置",
"type": "n8n-nodes-base.googleSheets",
"position": [
-2528,
2432
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "name",
"value": "CompanyConfig"
},
"documentId": {
"__rl": true,
"mode": "id",
"value": "YOUR_CONFIG_ID"
},
"authentication": "serviceAccount"
},
"credentials": {
"googleApi": {
"id": "ScSS2KxGQULuPtdy",
"name": "Google Sheets- test"
}
},
"typeVersion": 4.2
},
{
"id": "fda19308-3460-4416-b4c2-d1dafb8a053e",
"name": "分析截止日期",
"type": "n8n-nodes-base.code",
"position": [
-2304,
2336
],
"parameters": {
"jsCode": "const taxCalendar = $('Fetch Tax Calendar').all();\nconst companyConfig = $('Fetch Company Config').first().json;\nconst now = new Date();\nconst today = now.toISOString().split('T')[0];\n\nconst getDaysDifference = (date1, date2) => {\n const diffTime = new Date(date1) - new Date(date2);\n return Math.ceil(diffTime / (1000 * 60 * 60 * 24));\n};\n\nconst jurisdictions = (companyConfig.Jurisdictions || 'Federal').split(',').map(j => j.trim());\nconst entityType = companyConfig.EntityType || 'Corporation';\n\nconst upcomingDeadlines = [];\nconst criticalDeadlines = [];\nconst overdueDeadlines = [];\n\ntaxCalendar.forEach(item => {\n const deadline = item.json;\n const deadlineDate = new Date(deadline.DeadlineDate);\n const daysUntil = getDaysDifference(deadlineDate, now);\n \n if (deadline.IsActive !== 'TRUE' && deadline.IsActive !== true) return;\n \n const jurisdictionMatch = !deadline.Jurisdiction || jurisdictions.includes(deadline.Jurisdiction);\n const entityMatch = !deadline.EntityType || deadline.EntityType === entityType || deadline.EntityType === 'All';\n \n if (!jurisdictionMatch || !entityMatch) return;\n \n const deadlineInfo = {\n id: deadline.DeadlineID || `TAX-${Date.now()}`,\n name: deadline.DeadlineName,\n description: deadline.Description || '',\n deadlineDate: deadline.DeadlineDate,\n daysUntil: daysUntil,\n jurisdiction: deadline.Jurisdiction || 'Federal',\n category: deadline.Category || 'General',\n assignedTo: deadline.AssignedTo || 'Finance Team',\n penalties: deadline.Penalties || 'Standard penalties',\n priority: 'Normal'\n };\n \n if (daysUntil < 0) {\n deadlineInfo.priority = 'Critical';\n overdueDeadlines.push(deadlineInfo);\n } else if (daysUntil <= 3) {\n deadlineInfo.priority = 'Critical';\n criticalDeadlines.push(deadlineInfo);\n upcomingDeadlines.push(deadlineInfo);\n } else if (daysUntil <= 7) {\n deadlineInfo.priority = 'High';\n upcomingDeadlines.push(deadlineInfo);\n } else if (daysUntil <= 30) {\n deadlineInfo.priority = 'Medium';\n upcomingDeadlines.push(deadlineInfo);\n }\n});\n\nreturn {\n date: today,\n timestamp: now.toISOString(),\n jurisdictions: jurisdictions.join(', '),\n entityType: entityType,\n totalUpcoming: upcomingDeadlines.length,\n criticalCount: criticalDeadlines.length,\n overdueCount: overdueDeadlines.length,\n next7Days: upcomingDeadlines.filter(d => d.daysUntil <= 7).length,\n upcomingDeadlines: upcomingDeadlines,\n criticalDeadlines: criticalDeadlines,\n overdueDeadlines: overdueDeadlines,\n requiresImmediateAction: overdueDeadlines.length > 0 || criticalDeadlines.length > 0,\n alertLevel: overdueDeadlines.length > 0 ? 'CRITICAL' : criticalDeadlines.length > 0 ? 'HIGH' : 'MEDIUM'\n};"
},
"typeVersion": 2
},
{
"id": "18f3d827-6ffb-4ef9-9080-13a5bf65773b",
"name": "AI 分析",
"type": "n8n-nodes-base.httpRequest",
"position": [
-2080,
2336
],
"parameters": {
"url": "https://api.openai.com/v1/chat/completions",
"method": "POST",
"options": {},
"jsonBody": "={\n \"model\": \"gpt-4\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are a tax compliance advisor. Analyze deadlines and provide insights.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"Analyze these tax deadlines for {{ $json.date }}: {{ JSON.stringify($json.upcomingDeadlines) }}. Provide risk assessment and recommendations.\"\n }\n ]\n}",
"sendBody": true,
"specifyBody": "json"
},
"typeVersion": 4.2
},
{
"id": "f077e19c-408e-48da-9bd8-51ce5332459f",
"name": "合并 AI 洞察",
"type": "n8n-nodes-base.code",
"position": [
-1856,
2336
],
"parameters": {
"jsCode": "const deadlineData = $('Analyze Deadlines').first().json;\nconst aiResponse = $input.first().json;\n\nlet aiInsights = 'AI analysis completed';\ntry {\n aiInsights = aiResponse.choices[0].message.content;\n} catch (e) {\n aiInsights = 'AI analysis unavailable';\n}\n\nreturn {\n ...deadlineData,\n aiInsights: aiInsights\n};"
},
"typeVersion": 2
},
{
"id": "5d987c19-ccb9-48cc-8070-11c355c8f55f",
"name": "有截止日期",
"type": "n8n-nodes-base.if",
"position": [
-1632,
2336
],
"parameters": {
"options": {},
"conditions": {
"number": [
{
"value1": "={{ $json.totalUpcoming }}",
"value2": 0,
"operation": "larger"
}
]
}
},
"typeVersion": 2
},
{
"id": "db1f10ec-9594-4446-9c9d-c42321165efa",
"name": "是否关键",
"type": "n8n-nodes-base.if",
"position": [
-1408,
2240
],
"parameters": {
"options": {},
"conditions": {
"boolean": [
{
"value1": "={{ $json.requiresImmediateAction }}",
"value2": true
}
]
}
},
"typeVersion": 2
},
{
"id": "a8409e3e-720e-4163-b730-cfdfeb22a1b8",
"name": "格式化邮件",
"type": "n8n-nodes-base.code",
"position": [
-1184,
2144
],
"parameters": {
"jsCode": "const data = $input.first().json;\n\nconst emailHtml = `\n<html>\n<body style=\"font-family: Arial; padding: 20px;\">\n <div style=\"background: #1e3c72; color: white; padding: 30px; text-align: center;\">\n <h1>Tax Compliance Alert</h1>\n <p>${data.date} | Alert: ${data.alertLevel}</p>\n </div>\n <div style=\"padding: 20px;\">\n <h3>Summary</h3>\n <p><strong>Overdue:</strong> ${data.overdueCount}</p>\n <p><strong>Critical (≤3 days):</strong> ${data.criticalCount}</p>\n <p><strong>Next 7 Days:</strong> ${data.next7Days}</p>\n <p><strong>Total Upcoming:</strong> ${data.totalUpcoming}</p>\n ${data.overdueDeadlines.length > 0 ? `\n <div style=\"background: #ffebee; padding: 15px; margin: 20px 0;\">\n <h3 style=\"color: #c62828;\">OVERDUE DEADLINES</h3>\n ${data.overdueDeadlines.map(dl => `\n <p><strong>${dl.name}</strong><br>\n Due: ${dl.deadlineDate} (${Math.abs(dl.daysUntil)} days overdue)<br>\n Assigned: ${dl.assignedTo}</p>\n `).join('')}\n </div>\n ` : ''}\n ${data.criticalDeadlines.length > 0 ? `\n <div style=\"background: #fff3e0; padding: 15px; margin: 20px 0;\">\n <h3 style=\"color: #f57c00;\">CRITICAL DEADLINES</h3>\n ${data.criticalDeadlines.map(dl => `\n <p><strong>${dl.name}</strong><br>\n Due: ${dl.deadlineDate} (${dl.daysUntil} days)<br>\n Assigned: ${dl.assignedTo}</p>\n `).join('')}\n </div>\n ` : ''}\n <h3>AI Insights</h3>\n <p>${data.aiInsights}</p>\n </div>\n</body>\n</html>\n`;\n\nreturn {\n ...data,\n emailHtml: emailHtml,\n emailSubject: `${data.alertLevel} Tax Alert - ${data.overdueCount} Overdue, ${data.criticalCount} Critical`\n};"
},
"typeVersion": 2
},
{
"id": "3153af6e-e5eb-4560-a406-14b85781064a",
"name": "发送邮件",
"type": "n8n-nodes-base.emailSend",
"position": [
-960,
2144
],
"webhookId": "cf96020d-2cb8-4a71-b6f6-d211a2c56dcd",
"parameters": {
"options": {},
"subject": "={{ $json.emailSubject }}",
"toEmail": "cfo@company.com",
"fromEmail": "tax@company.com"
},
"credentials": {
"smtp": {
"id": "G1kyF8cSWTZ4vouN",
"name": "SMTP -test"
}
},
"typeVersion": 2.1
},
{
"id": "a57f0035-73a4-4720-8de1-9315d6a28c3a",
"name": "格式化 Slack",
"type": "n8n-nodes-base.code",
"position": [
-1184,
2336
],
"parameters": {
"jsCode": "const data = $input.first().json;\n\nconst blocks = [\n {\n type: \"header\",\n text: {\n type: \"plain_text\",\n text: `Tax Alert - ${data.date}`,\n emoji: true\n }\n },\n {\n type: \"section\",\n fields: [\n { type: \"mrkdwn\", text: `*Overdue:* ${data.overdueCount}` },\n { type: \"mrkdwn\", text: `*Critical:* ${data.criticalCount}` },\n { type: \"mrkdwn\", text: `*Next 7 Days:* ${data.next7Days}` },\n { type: \"mrkdwn\", text: `*Total:* ${data.totalUpcoming}` }\n ]\n }\n];\n\nif (data.overdueDeadlines.length > 0) {\n blocks.push({\n type: \"section\",\n text: {\n type: \"mrkdwn\",\n text: `*OVERDUE:*\\n${data.overdueDeadlines.map(dl => `• ${dl.name} - ${Math.abs(dl.daysUntil)} days overdue`).join('\\n')}`\n }\n });\n}\n\nif (data.criticalDeadlines.length > 0) {\n blocks.push({\n type: \"section\",\n text: {\n type: \"mrkdwn\",\n text: `*CRITICAL:*\\n${data.criticalDeadlines.map(dl => `• ${dl.name} - ${dl.daysUntil} days left`).join('\\n')}`\n }\n });\n}\n\nreturn { ...data, slackBlocks: blocks };"
},
"typeVersion": 2
},
{
"id": "12d16c58-99c9-4b5c-b35c-6ed7474f64a1",
"name": "发送到 Slack",
"type": "n8n-nodes-base.slack",
"position": [
-960,
2336
],
"webhookId": "65d9c2b2-262e-4881-aa9b-2979175cf756",
"parameters": {
"text": "=Tax Alert",
"select": "channel",
"channelId": {
"__rl": true,
"mode": "id",
"value": "C12345678"
},
"otherOptions": {}
},
"credentials": {
"slackApi": {
"id": "MQ0fgwuS8AzfwFvy",
"name": "Slack account - test "
}
},
"typeVersion": 2.2
},
{
"id": "6612a7be-3eb9-4283-b95f-e82867780a3c",
"name": "记录到表格1",
"type": "n8n-nodes-base.googleSheets",
"position": [
-1408,
2432
],
"parameters": {
"columns": {
"value": {},
"schema": [],
"mappingMode": "autoMapInputData",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "name",
"value": "ComplianceLog"
},
"documentId": {
"__rl": true,
"mode": "id",
"value": "YOUR_LOG_ID"
},
"authentication": "serviceAccount"
},
"credentials": {
"googleApi": {
"id": "ScSS2KxGQULuPtdy",
"name": "Google Sheets- test"
}
},
"typeVersion": 4.2
},
{
"id": "67ad55a3-bd1e-4bab-bf9a-1787565461b7",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2784,
2192
],
"parameters": {
"width": 182,
"height": 304,
"content": "**每日触发器** - 每天早上 8:00 运行"
},
"typeVersion": 1
},
{
"id": "7f4c325c-81be-4e9c-ab74-400d75704a90",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2560,
2048
],
"parameters": {
"color": 4,
"width": 182,
"height": 560,
"content": "**获取数据** - 从 Google Sheets 拉取税务日历和公司配置"
},
"typeVersion": 1
},
{
"id": "8002d149-5674-4f60-a5c7-2ad68a0d2f10",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2336,
2176
],
"parameters": {
"width": 182,
"height": 304,
"content": "**分析截止日期** - 计算剩余天数,按管辖区域/实体类型筛选,按优先级分类"
},
"typeVersion": 1
},
{
"id": "e4d30c91-ff1a-4463-81e7-a88ee1175514",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2128,
2176
],
"parameters": {
"color": 4,
"width": 182,
"height": 304,
"content": "**AI 分析** - GPT-4 提供关于即将到来截止日期的战略洞察和风险评估"
},
"typeVersion": 1
},
{
"id": "1402e736-4cbb-47a7-be96-237c269c5d19",
"name": "便签5",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1888,
2160
],
"parameters": {
"width": 614,
"height": 400,
"content": "**智能路由** - 仅当存在逾期或关键截止日期时发送警报"
},
"typeVersion": 1
},
{
"id": "4ed27c59-2e95-471f-89ea-c5309aaa6afc",
"name": "便签6",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1232,
1856
],
"parameters": {
"color": 4,
"width": 390,
"height": 640,
"content": "**关键警报** - 向高管发送 HTML 邮件 + 对紧急事项发送 Slack 警报"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "1853f22a-7d32-4bf5-a7da-329e185512f5",
"connections": {
"AI Analysis": {
"main": [
[
{
"node": "Merge AI Insights",
"type": "main",
"index": 0
}
]
]
},
"Is Critical": {
"main": [
[
{
"node": "Format Email",
"type": "main",
"index": 0
},
{
"node": "Format Slack",
"type": "main",
"index": 0
}
]
]
},
"Format Email": {
"main": [
[
{
"node": "Send Email",
"type": "main",
"index": 0
}
]
]
},
"Format Slack": {
"main": [
[
{
"node": "Send to Slack",
"type": "main",
"index": 0
}
]
]
},
"Has Deadlines": {
"main": [
[
{
"node": "Is Critical",
"type": "main",
"index": 0
},
{
"node": "Log to Sheet1",
"type": "main",
"index": 0
}
]
]
},
"Daily Tax Check": {
"main": [
[
{
"node": "Fetch Tax Calendar",
"type": "main",
"index": 0
},
{
"node": "Fetch Company Config",
"type": "main",
"index": 0
}
]
]
},
"Analyze Deadlines": {
"main": [
[
{
"node": "AI Analysis",
"type": "main",
"index": 0
}
]
]
},
"Merge AI Insights": {
"main": [
[
{
"node": "Has Deadlines",
"type": "main",
"index": 0
}
]
]
},
"Fetch Tax Calendar": {
"main": [
[
{
"node": "Analyze Deadlines",
"type": "main",
"index": 0
}
]
]
},
"Fetch Company Config": {
"main": [
[
{
"node": "Analyze Deadlines",
"type": "main",
"index": 0
}
]
]
}
}
}如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 文档提取, AI 摘要总结
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
Oneclick AI Squad
@oneclick-aiThe AI Squad Initiative is a pioneering effort to build, automate and scale AI-powered workflows using n8n.io. Our mission is to help individuals and businesses integrate AI agents seamlessly into their daily operations from automating tasks and enhancing productivity to creating innovative, intelligent solutions. We design modular, reusable AI workflow templates that empower creators, developers and teams to supercharge their automation with minimal effort and maximum impact.
分享此工作流