使用 Jotform、Xero 和 Slack 为客户生成发票
高级
这是一个自动化工作流,包含 20 个节点。主要使用 If, Code, Xero, Slack, Webhook 等节点。 通过 Jotform、Xero 和 GPT-4o-mini 实现发票生成与邮件发送的自动化
前置要求
- •Slack Bot Token 或 Webhook URL
- •HTTP Webhook 端点(n8n 会自动生成)
- •OpenAI API Key
分类
-
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "X2u0Wnuo2Yp8dSaq",
"meta": {
"instanceId": "3549451ca835035557d5dc1c3d9e6ba924e7314534a74c901f66b91f9ef6023e",
"templateCredsSetupCompleted": true
},
"name": "使用 Jotform、Xero 和 Slack 为客户生成发票",
"tags": [],
"nodes": [
{
"id": "5153a36b-decc-4145-bfb5-903123d3ed32",
"name": "接收表单提交",
"type": "n8n-nodes-base.webhook",
"position": [
-464,
0
],
"webhookId": "dac28968-ec17-41da-b720-c579c1a7169b",
"parameters": {
"path": "dac28968-ec17-41da-b720-c579c1a7169b",
"options": {},
"httpMethod": "POST"
},
"typeVersion": 2.1
},
{
"id": "a4e41795-f814-4f53-ae06-c004d9f2fe61",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-544,
-112
],
"parameters": {
"color": 7,
"width": 256,
"height": 320,
"content": "## 接收提交"
},
"typeVersion": 1
},
{
"id": "5d0f264c-57ab-4aa8-93a9-4a45a2ffe060",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
512,
80
],
"parameters": {
"color": 7,
"width": 288,
"height": 320,
"content": "## 创建联系人"
},
"typeVersion": 1
},
{
"id": "601c08b9-547d-4883-bdc0-c0e2725fb5c9",
"name": "便签5",
"type": "n8n-nodes-base.stickyNote",
"position": [
848,
-96
],
"parameters": {
"color": 7,
"width": 256,
"height": 320,
"content": "## 创建发票"
},
"typeVersion": 1
},
{
"id": "87296102-7ff7-4a22-a451-40749a219450",
"name": "便签7",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1328,
-480
],
"parameters": {
"width": 736,
"height": 992,
"content": "## 使用 Jotform、Xero 和 Slack 为客户生成发票"
},
"typeVersion": 1
},
{
"id": "bea06527-f4fb-4c06-acec-80e540753990",
"name": "便签8",
"type": "n8n-nodes-base.stickyNote",
"position": [
-240,
-112
],
"parameters": {
"color": 7,
"width": 256,
"height": 320,
"content": "## 格式化数据"
},
"typeVersion": 1
},
{
"id": "6f8c1525-ee7e-4d10-a0c0-641abe512e47",
"name": "格式化数据",
"type": "n8n-nodes-base.code",
"position": [
-160,
0
],
"parameters": {
"jsCode": "function extractAddressData(text) {\n const regex = /Street Address:\\s*([^<]+)<br>Street Address Line 2:\\s*([^<]+)<br>City:\\s*([^<]+)<br>State \\/ Province:\\s*([^<]+)<br>Postal \\/ Zip Code:\\s*([^<]+)<br>Country:\\s*([^<]+)<br>/;\n const matches = text.match(regex);\n \n if (matches) {\n return {\n line1: matches[1].trim(),\n line2: matches[2].trim(),\n city: matches[3].trim(),\n stateProvince: matches[4].trim(),\n postalZipCode: matches[5].trim(),\n country: matches[6].trim()\n };\n }\n \n return {\n line1: null,\n line2: null,\n city: null,\n stateProvince: null,\n postalZipCode: null,\n country: null\n }\n}\n\nreturn {\n address: extractAddressData($input.first().json.body.billingAddress),\n customer: {\n name: $input.first().json.body.name,\n email: $input.first().json.body.email,\n phone: $input.first().json.body.phone\n },\n item: {\n name: $input.first().json.body.itemName\n }\n}"
},
"typeVersion": 2
},
{
"id": "57002967-0cc2-416a-9b2d-5e0d7425e173",
"name": "创建发票",
"type": "n8n-nodes-base.xero",
"position": [
928,
16
],
"parameters": {
"type": "ACCREC",
"contactId": "={{ $json.ContactID }}",
"lineItemsUi": {
"lineItemsValues": [
{
"taxType": "INPUT",
"itemCode": "={{ $('Format data').item.json.item.name }}",
"unitAmount": "10",
"accountCode": "200"
}
]
},
"organizationId": "bc9a44a6-eb14-4f81-b24c-ca676c506446",
"additionalFields": {}
},
"credentials": {
"xeroOAuth2Api": {
"id": "HZnbTfrr5leqrLUQ",
"name": "Xero account"
}
},
"typeVersion": 1
},
{
"id": "606e45ad-d5b6-4a96-ac41-d2fd73bad8d3",
"name": "AI 代理",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
1280,
-352
],
"parameters": {
"text": "={{ $json }}",
"options": {
"systemMessage": "=You are an AI assistant that generates a professional invoice email that you get from an Xero response (newly created invoice), so you will recive an Xero invoice response and thus your job is to create a professional html email content because this html email content will be sent to the customer."
},
"promptType": "define"
},
"executeOnce": false,
"typeVersion": 2.2
},
{
"id": "486a7fee-acd9-46ad-bf2b-1bc815bfb2a4",
"name": "OpenAI 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
1280,
-144
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini",
"cachedResultName": "gpt-4o-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "ns8LVe1zpSS3Kw9p",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "da747ce1-ddcf-4c40-a78d-452d68cac37b",
"name": "便签19",
"type": "n8n-nodes-base.stickyNote",
"position": [
1168,
-480
],
"parameters": {
"color": 7,
"width": 592,
"height": 480,
"content": "## 发送发票"
},
"typeVersion": 1
},
{
"id": "0873e856-7c8a-46cf-b7d1-c7a75afb0c6a",
"name": "发送邮件",
"type": "n8n-nodes-base.emailSend",
"position": [
1552,
-352
],
"webhookId": "8f9ba8d7-7a97-4926-b640-8dc93c30eed8",
"parameters": {
"html": "={{ $json.output }}",
"options": {},
"subject": "=New Invoice",
"toEmail": "={{ $('Create the invoice').item.json.Contact.EmailAddress }}",
"fromEmail": "system@example.com"
},
"credentials": {
"smtp": {
"id": "awV8UBK3MYzosMxe",
"name": "Mailtrap SMTP account"
}
},
"typeVersion": 2.1
},
{
"id": "1af9a24d-7ac1-47b4-a17a-2774f01c860c",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
64,
-112
],
"parameters": {
"color": 7,
"width": 400,
"height": 320,
"content": "## 检查联系人是否存在"
},
"typeVersion": 1
},
{
"id": "994373c3-4f87-48cc-a30e-d34b0b345f12",
"name": "检查客户是否存在",
"type": "n8n-nodes-base.xero",
"position": [
128,
0
],
"parameters": {
"limit": 1,
"options": {
"where": "=EmailAddress=\"{{ $json.customer.email }}\""
},
"resource": "contact",
"operation": "getAll",
"organizationId": "bc9a44a6-eb14-4f81-b24c-ca676c506446"
},
"credentials": {
"xeroOAuth2Api": {
"id": "HZnbTfrr5leqrLUQ",
"name": "Xero account"
}
},
"typeVersion": 1,
"alwaysOutputData": true
},
{
"id": "14c4b4df-ce15-4e52-a89e-5a92db87b86b",
"name": "如果",
"type": "n8n-nodes-base.if",
"position": [
304,
0
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "bfa24559-7702-4ebf-909d-c5c2a60ad817",
"operator": {
"type": "object",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json }}",
"rightValue": 0
},
{
"id": "b4301cfe-a22a-490f-a72b-50d266bc1c5e",
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.ContactID }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "b6eb0744-cb7e-4676-91d5-6272ceb21924",
"name": "创建新联系人",
"type": "n8n-nodes-base.xero",
"position": [
608,
192
],
"parameters": {
"name": "={{ $('Format data').item.json.customer.name }}",
"resource": "contact",
"organizationId": "bc9a44a6-eb14-4f81-b24c-ca676c506446",
"additionalFields": {
"phonesUi": {
"phonesValues": [
{
"phoneType": "MOBILE",
"phoneNumber": "={{ $('Format data').item.json.customer.phone }}"
}
]
},
"addressesUi": {
"addressesValues": [
{
"city": "={{ $('Format data').item.json.address.city }}",
"type": "STREET",
"line1": "={{ $('Format data').item.json.address.line1 }}",
"line2": "={{ $('Format data').item.json.address.line2 }}",
"region": "={{ $('Format data').item.json.address.stateProvince }}",
"country": "={{ $('Format data').item.json.address.country }}",
"postalCode": "={{ $('Format data').item.json.address.postalZipCode }}"
}
]
},
"emailAddress": "={{ $('Format data').item.json.customer.email }}"
}
},
"credentials": {
"xeroOAuth2Api": {
"id": "HZnbTfrr5leqrLUQ",
"name": "Xero account"
}
},
"typeVersion": 1
},
{
"id": "c035f5c2-0822-4b73-b553-4a06c39bc867",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
512,
-304
],
"parameters": {
"color": 7,
"width": 288,
"height": 320,
"content": "## 更新联系人"
},
"typeVersion": 1
},
{
"id": "bc245137-a2fa-4817-bf79-e6bd0bcd4688",
"name": "更新联系人",
"type": "n8n-nodes-base.xero",
"position": [
608,
-192
],
"parameters": {
"resource": "contact",
"contactId": "={{ $json.ContactID }}",
"operation": "update",
"updateFields": {
"name": "={{ $('Format data').item.json.customer.name }}",
"phonesUi": {
"phonesValues": [
{
"phoneType": "MOBILE",
"phoneNumber": "={{ $('Format data').item.json.customer.phone }}"
}
]
}
},
"organizationId": "bc9a44a6-eb14-4f81-b24c-ca676c506446"
},
"credentials": {
"xeroOAuth2Api": {
"id": "HZnbTfrr5leqrLUQ",
"name": "Xero account"
}
},
"typeVersion": 1
},
{
"id": "ecf29c2f-7e91-41d1-a99b-8a2de86b7ce0",
"name": "便签6",
"type": "n8n-nodes-base.stickyNote",
"position": [
1168,
112
],
"parameters": {
"color": 7,
"width": 288,
"height": 320,
"content": "## 通知团队"
},
"typeVersion": 1
},
{
"id": "09ccbef2-8aa7-4b19-8e8b-86d6aa647298",
"name": "通知团队",
"type": "n8n-nodes-base.slack",
"position": [
1264,
240
],
"webhookId": "e19cadcc-f539-4184-8451-9923be34b8ca",
"parameters": {
"text": "=<!channel> A new invoice with the below details have bene created:\n*Invoice Number:* {{ $json.InvoiceNumber }}\n*Amount Due:* {{ $json.AmountDue }} ({{ $json.CurrencyCode }})\n*Status:* {{ $json.Status }}",
"select": "channel",
"channelId": {
"__rl": true,
"mode": "name",
"value": "#test"
},
"otherOptions": {}
},
"credentials": {
"slackApi": {
"id": "mRsbuKKHsrN3Qgaj",
"name": "Slack account"
}
},
"typeVersion": 2.3
}
],
"active": false,
"pinData": {
"Receive form submission": [
{
"json": {
"body": {
"name": "Adrian Mathews",
"email": "yoled82772@elygifts.com",
"phone": "(116) 777-9916",
"itemName": "Design",
"billingAddress": "Street Address: Nulla quia debitis est quam facilis amet enim cupidatat officia autem consequatur qui quis dolorem<br>Street Address Line 2: Possimus perferendis ad veritatis quia animi<br>City: Voluptatibus eveniet harum unde dolor doloremque cumque dol<br>State / Province: Reprehenderit rerum voluptas magni ut minim ad deleniti eni<br>Postal / Zip Code: 17167<br>Country: Seychelles<br>"
}
}
}
]
},
"settings": {
"executionOrder": "v1"
},
"versionId": "f403ca7a-cd06-4122-ab76-c7cbc0f93d93",
"connections": {
"14c4b4df-ce15-4e52-a89e-5a92db87b86b": {
"main": [
[
{
"node": "bc245137-a2fa-4817-bf79-e6bd0bcd4688",
"type": "main",
"index": 0
}
],
[
{
"node": "b6eb0744-cb7e-4676-91d5-6272ceb21924",
"type": "main",
"index": 0
}
]
]
},
"606e45ad-d5b6-4a96-ac41-d2fd73bad8d3": {
"main": [
[
{
"node": "0873e856-7c8a-46cf-b7d1-c7a75afb0c6a",
"type": "main",
"index": 0
}
]
]
},
"6f8c1525-ee7e-4d10-a0c0-641abe512e47": {
"main": [
[
{
"node": "994373c3-4f87-48cc-a30e-d34b0b345f12",
"type": "main",
"index": 0
}
]
]
},
"bc245137-a2fa-4817-bf79-e6bd0bcd4688": {
"main": [
[
{
"node": "57002967-0cc2-416a-9b2d-5e0d7425e173",
"type": "main",
"index": 0
}
]
]
},
"486a7fee-acd9-46ad-bf2b-1bc815bfb2a4": {
"ai_languageModel": [
[
{
"node": "606e45ad-d5b6-4a96-ac41-d2fd73bad8d3",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"b6eb0744-cb7e-4676-91d5-6272ceb21924": {
"main": [
[
{
"node": "57002967-0cc2-416a-9b2d-5e0d7425e173",
"type": "main",
"index": 0
}
]
]
},
"57002967-0cc2-416a-9b2d-5e0d7425e173": {
"main": [
[
{
"node": "606e45ad-d5b6-4a96-ac41-d2fd73bad8d3",
"type": "main",
"index": 0
},
{
"node": "09ccbef2-8aa7-4b19-8e8b-86d6aa647298",
"type": "main",
"index": 0
}
]
]
},
"5153a36b-decc-4145-bfb5-903123d3ed32": {
"main": [
[
{
"node": "6f8c1525-ee7e-4d10-a0c0-641abe512e47",
"type": "main",
"index": 0
}
]
]
},
"994373c3-4f87-48cc-a30e-d34b0b345f12": {
"main": [
[
{
"node": "14c4b4df-ce15-4e52-a89e-5a92db87b86b",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
使用 Jotform 和 Xero 为客户生成发票并发送提醒
使用Jotform和Xero生成发票并发送AI驱动的提醒
If
Set
Code
+
If
Set
Code
39 节点AppUnits AI
使用Jotform、Xero、Outlook和Telegram自动创建发票和团队通知
使用Jotform、Xero、Outlook和Telegram自动创建发票并进行客户沟通
If
Code
Wait
+
If
Code
Wait
27 节点AppUnits AI
使用 Jotform 和 QuickBooks 为客户生成发票并发送提醒
使用Jotform和QuickBooks生成发票并发送AI摘要提醒
If
Set
Code
+
If
Set
Code
48 节点AppUnits AI
使用 Jotform、QuickBooks 和 Outlook 生成发票并发送提醒给客户
通过 Jotform、QuickBooks 和 Outlook AI 实现发票创建与智能提醒的自动化
If
Set
Code
+
If
Set
Code
48 节点AppUnits AI
为客户生成发票并发送提醒
使用QuickBooks、Jotform和GPT-4o自动生成发票和付款提醒
If
Set
Code
+
If
Set
Code
48 节点AppUnits AI
使用Jotform、Xero和Gmail为客户生成发票
使用Jotform、Xero和GPT驱动的邮件生成专业发票
Code
Xero
Gmail
+
Code
Xero
Gmail
13 节点AppUnits AI