Stripe 税务摘要到 Google Sheets 并附带 Slack 提醒
高级
这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 17 个节点。主要使用 If, Set, Code, Slack, Stripe 等节点。 从 Stripe 生成税务摘要,存储到 Google Sheets,并发送 Slack 提醒
前置要求
- •Slack Bot Token 或 Webhook URL
- •Stripe API Key
- •Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "zRKz4PZ9O47qu8nx",
"meta": {
"instanceId": "8443f10082278c46aa5cf3acf8ff0f70061a2c58bce76efac814b16290845177",
"templateCredsSetupCompleted": true
},
"name": "Stripe 税务摘要到 Google Sheets 并附带 Slack 提醒",
"tags": [],
"nodes": [
{
"id": "1ef1afae-2f4e-42b4-bcbe-04879dc757fc",
"name": "税务摘要工作流概览",
"type": "n8n-nodes-base.stickyNote",
"position": [
336,
-112
],
"parameters": {
"width": 389,
"height": 704,
"content": "## 📊 Stripe 税务摘要报告自动化"
},
"typeVersion": 1
},
{
"id": "83f6e13b-315c-4bcd-a2af-9aeba3d657da",
"name": "处理计划",
"type": "n8n-nodes-base.stickyNote",
"position": [
768,
-512
],
"parameters": {
"width": 300,
"height": 508,
"content": "## ⏰ 每日税务处理计划"
},
"typeVersion": 1
},
{
"id": "acac1ac0-6818-4dc4-9d97-52ab8a45103e",
"name": "每日税务处理触发器",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
944,
16
],
"parameters": {
"rule": {
"interval": [
{
"field": "cronExpression",
"expression": "0 2 * * *"
}
]
}
},
"typeVersion": 1.1
},
{
"id": "9ea1dc34-54b0-431a-a99b-d8b034a035c6",
"name": "Stripe 数据获取",
"type": "n8n-nodes-base.stickyNote",
"position": [
1008,
224
],
"parameters": {
"width": 300,
"height": 580,
"content": "## 💳 Stripe 发票数据检索"
},
"typeVersion": 1
},
{
"id": "99ff779c-2996-40b0-ac06-849a83de75f1",
"name": "获取带税务数据的已支付发票",
"type": "n8n-nodes-base.stripe",
"position": [
1168,
16
],
"parameters": {
"resource": "invoice"
},
"credentials": {
"stripeApi": {
"id": "DV4tPpxjbOUkGfAx",
"name": "Stripe account"
}
},
"typeVersion": 1
},
{
"id": "601354df-03e6-4009-8315-103cf865a3e3",
"name": "数据验证",
"type": "n8n-nodes-base.stickyNote",
"position": [
1248,
-528
],
"parameters": {
"width": 300,
"height": 504,
"content": "## ✅ 数据验证检查"
},
"typeVersion": 1
},
{
"id": "350fd6f2-70d7-4857-b7d5-9dfb3429e161",
"name": "验证发票数据存在",
"type": "n8n-nodes-base.if",
"position": [
1376,
16
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "data-exists",
"operator": {
"type": "array",
"operation": "lengthGt",
"rightType": "number"
},
"leftValue": "={{ $json.data }}",
"rightValue": 0
}
]
}
},
"typeVersion": 2
},
{
"id": "6f79bead-6312-47ce-90de-aed6ebb86e61",
"name": "税务处理逻辑",
"type": "n8n-nodes-base.stickyNote",
"position": [
1568,
-704
],
"parameters": {
"width": 300,
"height": 616,
"content": "## 🧮 税务数据处理引擎"
},
"typeVersion": 1
},
{
"id": "d4547ae7-4cff-465e-9502-982ab05be9e9",
"name": "按管辖区计算税务摘要",
"type": "n8n-nodes-base.code",
"position": [
1600,
-64
],
"parameters": {
"jsCode": "const invoices = $input.all();\nconst taxSummary = new Map();\n\nconsole.log('Processing invoices for tax summary:', invoices.length);\n\nfor (const invoice of invoices) {\n // Handle Stripe API response structure\n const invoiceData = invoice.json.data || invoice.json;\n \n if (!invoiceData || !Array.isArray(invoiceData)) {\n console.log('Skipping invalid invoice data');\n continue;\n }\n \n for (const invoiceItem of invoiceData) {\n const invoiceDate = new Date(invoiceItem.created * 1000);\n const period = `${invoiceDate.getFullYear()}-${String(invoiceDate.getMonth() + 1).padStart(2, '0')}`;\n \n // Extract country from account or customer data\n const country = invoiceItem.account_country || \n invoiceItem.customer_details?.address?.country || \n 'Unknown';\n \n // Process line items with tax information\n if (invoiceItem.lines && invoiceItem.lines.data && invoiceItem.lines.data.length > 0) {\n for (const line of invoiceItem.lines.data) {\n // Process tax amounts if available\n if (line.tax_amounts && line.tax_amounts.length > 0) {\n for (const taxAmount of line.tax_amounts) {\n const taxRate = taxAmount.tax_rate ? (taxAmount.tax_rate.percentage || 0) : 0;\n const jurisdiction = taxAmount.tax_rate ? (taxAmount.tax_rate.jurisdiction || '') : '';\n const state = jurisdiction.includes('-') ? jurisdiction.split('-')[1] : jurisdiction;\n \n const key = `${period}|${country}|${state}|${taxRate}`;\n \n if (!taxSummary.has(key)) {\n taxSummary.set(key, {\n period,\n country,\n state,\n taxRate,\n taxableAmount: 0,\n taxCollected: 0\n });\n }\n \n const summary = taxSummary.get(key);\n summary.taxableAmount += (line.amount || 0) / 100; // Convert from cents\n summary.taxCollected += (taxAmount.amount || 0) / 100; // Convert from cents\n }\n } else {\n // Handle lines without tax (tax-exempt or zero-rate)\n const key = `${period}|${country}||0`;\n \n if (!taxSummary.has(key)) {\n taxSummary.set(key, {\n period,\n country,\n state: '',\n taxRate: 0,\n taxableAmount: 0,\n taxCollected: 0\n });\n }\n \n const summary = taxSummary.get(key);\n summary.taxableAmount += (line.amount || 0) / 100;\n }\n }\n } else {\n // Handle invoices without detailed line items\n const key = `${period}|${country}||0`;\n \n if (!taxSummary.has(key)) {\n taxSummary.set(key, {\n period,\n country,\n state: '',\n taxRate: 0,\n taxableAmount: 0,\n taxCollected: 0\n });\n }\n \n const summary = taxSummary.get(key);\n summary.taxableAmount += (invoiceItem.total || 0) / 100;\n summary.taxCollected += (invoiceItem.tax || 0) / 100;\n }\n }\n}\n\n// Format results for output\nconst result = Array.from(taxSummary.values()).map(summary => ({\n json: {\n period: summary.period,\n country: summary.country,\n state: summary.state || '',\n taxRate: summary.taxRate,\n taxableAmount: Math.round(summary.taxableAmount * 100) / 100,\n taxCollected: Math.round(summary.taxCollected * 100) / 100,\n processingDate: new Date().toISOString().split('T')[0]\n }\n}));\n\nconsole.log(`Generated ${result.length} tax summary records`);\n\nreturn result.length > 0 ? result : [{ \n json: { \n message: 'No tax data found for the period',\n period: new Date().toISOString().substring(0, 7),\n processingDate: new Date().toISOString().split('T')[0]\n } \n}];"
},
"typeVersion": 2
},
{
"id": "1b14a11e-dabf-40c4-88af-cbde96cfe81b",
"name": "数据准备",
"type": "n8n-nodes-base.stickyNote",
"position": [
1776,
96
],
"parameters": {
"width": 300,
"height": 536,
"content": "## 📋 用于 Sheets 的数据准备"
},
"typeVersion": 1
},
{
"id": "67fc5b14-e826-488c-9bfa-ef2573af3fa7",
"name": "为 Google Sheets 格式化数据",
"type": "n8n-nodes-base.set",
"position": [
1824,
-64
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "fc3bb9e0-f7e3-430d-936b-b198e204cf8b",
"name": "period",
"type": "string",
"value": "={{ $json.period }}"
},
{
"id": "f065e7b9-9223-49c8-a1ca-3405483cc2a8",
"name": "country",
"type": "string",
"value": "={{ $json.country }}"
},
{
"id": "a0d0ecca-17d5-470d-8bd4-621d666e0306",
"name": "state",
"type": "string",
"value": "={{ $json.state || '' }}"
},
{
"id": "cd649a01-829d-4205-837f-5e4790860b85",
"name": "taxRate",
"type": "number",
"value": "={{ $json.taxRate }}"
},
{
"id": "ba84aeef-ce9f-4605-98eb-75ba8cf5f3a7",
"name": "taxableAmount",
"type": "number",
"value": "={{ $json.taxableAmount }}"
},
{
"id": "de2a7a75-e865-4157-b41f-8fdd258475a0",
"name": "taxCollected",
"type": "number",
"value": "={{ $json.taxCollected }}"
},
{
"id": "processing-date",
"name": "processingDate",
"type": "string",
"value": "={{ $json.processingDate }}"
}
]
}
},
"typeVersion": 3.3
},
{
"id": "c56bec91-eb1f-4194-92be-7c300542359b",
"name": "Sheets 集成",
"type": "n8n-nodes-base.stickyNote",
"position": [
1952,
-704
],
"parameters": {
"width": 300,
"height": 576,
"content": "## 📊 Google Sheets 税务报告"
},
"typeVersion": 1
},
{
"id": "92c6ab15-5988-417a-8622-4f531c18f2d8",
"name": "更新税务摘要电子表格",
"type": "n8n-nodes-base.googleSheets",
"position": [
2048,
-64
],
"parameters": {
"columns": {
"value": {},
"schema": [
{
"id": "period",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Period",
"defaultMatch": true,
"canBeUsedToMatch": true
},
{
"id": "country",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Country",
"defaultMatch": true,
"canBeUsedToMatch": true
},
{
"id": "state",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "State/Province",
"defaultMatch": true,
"canBeUsedToMatch": true
},
{
"id": "taxRate",
"type": "number",
"display": true,
"removed": false,
"required": false,
"displayName": "Tax Rate (%)",
"defaultMatch": true,
"canBeUsedToMatch": true
},
{
"id": "taxableAmount",
"type": "number",
"display": true,
"removed": false,
"required": false,
"displayName": "Taxable Amount",
"defaultMatch": false,
"canBeUsedToMatch": false
},
{
"id": "taxCollected",
"type": "number",
"display": true,
"removed": false,
"required": false,
"displayName": "Tax Collected",
"defaultMatch": false,
"canBeUsedToMatch": false
},
{
"id": "processingDate",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Processing Date",
"defaultMatch": false,
"canBeUsedToMatch": false
}
],
"mappingMode": "autoMapInputData",
"matchingColumns": [
"period",
"country",
"state",
"taxRate"
],
"attemptToConvertTypes": true,
"convertFieldsToString": false
},
"options": {
"useAppend": false
},
"operation": "appendOrUpdate",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "{{ $env.GOOGLE_SHEETS_SHEET_NAME || 'Tax Summary' }}",
"cachedResultName": "Tax Summary"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "{{ $env.GOOGLE_SHEETS_DOCUMENT_ID }}",
"cachedResultName": "Tax Summary Report"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "kpPEOLCGn963qpoh",
"name": "automations@techdome.ai"
}
},
"typeVersion": 4.3
},
{
"id": "489bb7df-223a-462a-9526-3f7caa35eb8d",
"name": "成功通知",
"type": "n8n-nodes-base.stickyNote",
"position": [
2272,
112
],
"parameters": {
"width": 300,
"height": 540,
"content": "## 📢 成功通知设置"
},
"typeVersion": 1
},
{
"id": "ab64553d-7549-46b3-8b2d-1e7867f2d992",
"name": "发送成功通知到 Slack",
"type": "n8n-nodes-base.slack",
"position": [
2272,
-64
],
"webhookId": "5d751d19-e0dd-48e2-84c5-a95754a2883f",
"parameters": {
"text": "✅ **Tax Summary Report Generated Successfully**\n\n📊 **Processing Summary:**\n• Period: {{ $('Calculate Tax Summary by Jurisdiction').first().json.period || 'Current Month' }}\n• Records Processed: {{ $('Calculate Tax Summary by Jurisdiction').all().length }}\n• Total Taxable Amount: ${{ $('Calculate Tax Summary by Jurisdiction').all().reduce((sum, item) => sum + (item.json.taxableAmount || 0), 0).toFixed(2) }}\n• Total Tax Collected: ${{ $('Calculate Tax Summary by Jurisdiction').all().reduce((sum, item) => sum + (item.json.taxCollected || 0), 0).toFixed(2) }}\n\n🕒 **Completed:** {{ new Date().toLocaleString() }}\n📋 **View Report:** Google Sheets updated with latest tax data\n\n💡 Next scheduled run: Tomorrow at 2:00 AM",
"select": "channel",
"channelId": {
"__rl": true,
"mode": "list",
"value": "{{ $env.SLACK_CHANNEL_ID }}",
"cachedResultName": "tax-reports"
},
"otherOptions": {
"mrkdwn": true
}
},
"credentials": {
"slackApi": {
"id": "rNqvWj9TfChPVRYY",
"name": "Slack account vivek"
}
},
"typeVersion": 2.1
},
{
"id": "257f1d24-e589-404e-8ab6-5f0e42ef95db",
"name": "错误处理",
"type": "n8n-nodes-base.stickyNote",
"position": [
1424,
320
],
"parameters": {
"width": 300,
"height": 504,
"content": "## ❌ 错误通知设置"
},
"typeVersion": 1
},
{
"id": "8fcfa5cf-9d4c-4e36-b18e-0bb8450854aa",
"name": "发送错误通知到 Slack",
"type": "n8n-nodes-base.slack",
"position": [
1600,
144
],
"webhookId": "fcb9cae2-b6fe-42b3-904d-8d48155ca630",
"parameters": {
"text": "❌ **Tax Summary Workflow Failed**\n\n🚨 **Error Details:**\n• Issue: No invoice data found or data validation failed\n• Possible Causes:\n - No paid invoices in the last 30 days\n - Stripe API connection issues\n - Missing tax configuration in Stripe\n - Network connectivity problems\n\n🕒 **Failed At:** {{ new Date().toLocaleString() }}\n\n🔧 **Troubleshooting Steps:**\n1. Check Stripe API credentials\n2. Verify invoice data exists for the period\n3. Review Stripe tax configuration\n4. Check n8n execution logs\n\n💬 **Support:** Please check the workflow execution details in n8n dashboard\n⏰ **Next Retry:** Tomorrow at 2:00 AM",
"select": "channel",
"channelId": {
"__rl": true,
"mode": "list",
"value": "{{ $env.SLACK_CHANNEL_ID }}",
"cachedResultName": "tax-reports"
},
"otherOptions": {
"mrkdwn": true
}
},
"credentials": {
"slackApi": {
"id": "rNqvWj9TfChPVRYY",
"name": "Slack account vivek"
}
},
"typeVersion": 2.1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "d107c22e-17e6-4f0d-9ebe-d4c37e477602",
"connections": {
"Daily Tax Processing Trigger": {
"main": [
[
{
"node": "Fetch Paid Invoices with Tax Data",
"type": "main",
"index": 0
}
]
]
},
"Validate Invoice Data Exists": {
"main": [
[
{
"node": "Calculate Tax Summary by Jurisdiction",
"type": "main",
"index": 0
}
],
[
{
"node": "Send Error Notification to Slack",
"type": "main",
"index": 0
}
]
]
},
"Format Data for Google Sheets": {
"main": [
[
{
"node": "Update Tax Summary Spreadsheet",
"type": "main",
"index": 0
}
]
]
},
"Update Tax Summary Spreadsheet": {
"main": [
[
{
"node": "Send Success Notification to Slack",
"type": "main",
"index": 0
}
]
]
},
"Fetch Paid Invoices with Tax Data": {
"main": [
[
{
"node": "Validate Invoice Data Exists",
"type": "main",
"index": 0
}
]
]
},
"Calculate Tax Summary by Jurisdiction": {
"main": [
[
{
"node": "Format Data for Google Sheets",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 内容创作, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
GoHighLevel管道速度跟踪器和自动化停滞交易提醒
使用GoHighLevel、Gmail和Slack分析管道速度并提醒停滞交易
If
Code
Gmail
+5
25 节点Rahul Joshi
内容创作
Airtable订单到Stripe发票(B2B/手动收款)
从Airtable订单创建Stripe发票,并使用Google表格记录
If
Code
Stripe
+5
19 节点Rahul Joshi
内容创作
监控Zendesk流失风险信号并在Slack中通知CS团队
监控Zendesk流失风险信号,记录到表格,并在Slack中通知团队
If
Code
Slack
+4
12 节点Rahul Joshi
内容创作
使用GoHighLevel、Gmail、Slack和Sheets的每周客户互动自动化
每周客户再互动系统(GoHighLevel、Gmail、Sheets和Slack)
If
Code
Gmail
+7
23 节点Rahul Joshi
内容创作
面试质量审计
使用GPT-4o-mini和Google表格通过Slack审核面试反馈并生成报告
If
Code
Slack
+5
23 节点Rahul Joshi
内容创作
季度/月度收入摘要发送至 Slack
使用财务洞察自动将月度及季度 Stripe 收入报告发送至 Slack
Code
Merge
Slack
+4
18 节点Rahul Joshi
内容创作
工作流信息
难度等级
高级
节点数量17
分类2
节点类型8
作者
Rahul Joshi
@rahul08Rahul Joshi is a seasoned technology leader specializing in the n8n automation tool and AI-driven workflow automation. With deep expertise in building open-source workflow automation and self-hosted automation platforms, he helps organizations eliminate manual processes through intelligent n8n ai agent automation solutions.
外部链接
在 n8n.io 查看 →
分享此工作流