8
n8n 中文网amn8n.com

使用 Jotform 和 QuickBooks 为客户生成发票

高级

这是一个自动化工作流,包含 22 个节点。主要使用 If, Code, Webhook, Quickbooks 等节点。 使用Jotform和QuickBooks为客户生成发票

前置要求
  • HTTP Webhook 端点(n8n 会自动生成)

分类

-
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "9JbuwG2cZQVIvUHn",
  "meta": {
    "instanceId": "3549451ca835035557d5dc1c3d9e6ba924e7314534a74c901f66b91f9ef6023e",
    "templateCredsSetupCompleted": true
  },
  "name": "使用 Jotform 和 QuickBooks 为客户生成发票",
  "tags": [],
  "nodes": [
    {
      "id": "4f6366d5-b755-4bec-83eb-482efdba74a3",
      "name": "接收表单提交",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -464,
        0
      ],
      "webhookId": "d65e73cf-179b-4021-82d0-4ebeccb4cd10",
      "parameters": {
        "path": "requests",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2.1
    },
    {
      "id": "6d770cb0-0b36-484c-9c58-46afe7a4bb8a",
      "name": "条件判断",
      "type": "n8n-nodes-base.if",
      "position": [
        320,
        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.Id }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "4391d022-ce12-41ab-ab4b-c35143f6ac38",
      "name": "获取产品",
      "type": "n8n-nodes-base.quickbooks",
      "position": [
        1248,
        0
      ],
      "parameters": {
        "limit": 1,
        "filters": {
          "query": "=WHERE name = '{{ $json.item.name }}'"
        },
        "resource": "item",
        "operation": "getAll"
      },
      "credentials": {
        "quickBooksOAuth2Api": {
          "id": "E1S8XZZk9iMCPDSN",
          "name": "QuickBooks Online account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b13d423b-9fe9-44d2-ac74-93b193a5de1b",
      "name": "创建发票",
      "type": "n8n-nodes-base.quickbooks",
      "position": [
        1856,
        0
      ],
      "parameters": {
        "Line": [
          {
            "Amount": 1,
            "itemId": "={{ $json.item.id }}",
            "DetailType": "SalesItemLineDetail",
            "Description": "Jotform submission"
          }
        ],
        "resource": "invoice",
        "operation": "create",
        "CustomerRef": "={{ $json.customer.id }}",
        "additionalFields": {}
      },
      "credentials": {
        "quickBooksOAuth2Api": {
          "id": "E1S8XZZk9iMCPDSN",
          "name": "QuickBooks Online account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "08437c34-4454-4690-a752-d011945caf5a",
      "name": "发送发票",
      "type": "n8n-nodes-base.quickbooks",
      "position": [
        2160,
        0
      ],
      "parameters": {
        "email": "={{ $('Add item id').item.json.customer.email }}",
        "resource": "invoice",
        "invoiceId": "={{ $json.Id }}",
        "operation": "send"
      },
      "credentials": {
        "quickBooksOAuth2Api": {
          "id": "E1S8XZZk9iMCPDSN",
          "name": "QuickBooks Online account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b0b10282-e6a3-459b-ae3d-23a4aeec885b",
      "name": "检查客户是否存在",
      "type": "n8n-nodes-base.quickbooks",
      "position": [
        112,
        0
      ],
      "parameters": {
        "limit": 1,
        "filters": {
          "query": "=Where PrimaryEmailAddr = '{{ $json.customer.email }}'"
        },
        "operation": "getAll"
      },
      "credentials": {
        "quickBooksOAuth2Api": {
          "id": "E1S8XZZk9iMCPDSN",
          "name": "QuickBooks Online account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "db4fa3c0-89fd-48b6-b2f4-c5e1e188e622",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -544,
        -112
      ],
      "parameters": {
        "color": 7,
        "width": 256,
        "height": 320,
        "content": "## 接收提交"
      },
      "typeVersion": 1
    },
    {
      "id": "6b756b11-0a93-4df7-b8fb-82c65057c6c6",
      "name": "便签 1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        64,
        -112
      ],
      "parameters": {
        "color": 7,
        "width": 400,
        "height": 320,
        "content": "## 检查客户是否存在"
      },
      "typeVersion": 1
    },
    {
      "id": "c7e5987a-8bf2-4651-becb-70bf5b039b14",
      "name": "便签 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        512,
        -336
      ],
      "parameters": {
        "color": 7,
        "width": 304,
        "height": 336,
        "content": "## 客户存在"
      },
      "typeVersion": 1
    },
    {
      "id": "8f1d632d-cf26-4bb2-80e9-c019cde28bdb",
      "name": "创建客户",
      "type": "n8n-nodes-base.quickbooks",
      "position": [
        608,
        176
      ],
      "parameters": {
        "operation": "create",
        "displayName": "=",
        "additionalFields": {
          "BillAddr": {
            "details": {
              "City": "={{ $('Format data').item.json.address.city }}",
              "Line1": "={{ $('Format data').item.json.address.line1 }}",
              "PostalCode": "={{ $('Format data').item.json.address.postalZipCode }}"
            }
          },
          "GivenName": "={{ $('Format data').item.json.customer.name }}",
          "PrimaryPhone": "={{ $('Format data').item.json.customer.phone }}",
          "PrimaryEmailAddr": "={{ $('Format data').item.json.customer.email }}"
        }
      },
      "credentials": {
        "quickBooksOAuth2Api": {
          "id": "E1S8XZZk9iMCPDSN",
          "name": "QuickBooks Online account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "d3f307c0-6e27-4212-bd2c-ab585a6ac095",
      "name": "更新客户",
      "type": "n8n-nodes-base.quickbooks",
      "position": [
        608,
        -192
      ],
      "parameters": {
        "operation": "update",
        "customerId": "={{ $json.Id }}",
        "updateFields": {
          "BillAddr": {
            "details": {
              "City": "={{ $('Format data').item.json.address.city }}",
              "Line1": "={{ $('Format data').item.json.address.line1 }}",
              "PostalCode": "={{ $('Format data').item.json.address.postalZipCode }}"
            }
          },
          "GivenName": "={{ $('Format data').item.json.customer.name }}",
          "PrimaryPhone": "={{ $('Format data').item.json.customer.phone }}"
        }
      },
      "credentials": {
        "quickBooksOAuth2Api": {
          "id": "E1S8XZZk9iMCPDSN",
          "name": "QuickBooks Online account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "74f2a7f2-35bf-43e0-979b-6032cca27c40",
      "name": "便签 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        512,
        48
      ],
      "parameters": {
        "color": 7,
        "width": 304,
        "height": 320,
        "content": "## 客户不存在"
      },
      "typeVersion": 1
    },
    {
      "id": "b8ea9c7a-f469-4a6d-99c5-3b4b952368b6",
      "name": "便签 4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1168,
        -112
      ],
      "parameters": {
        "color": 7,
        "width": 256,
        "height": 320,
        "content": "## 获取项目"
      },
      "typeVersion": 1
    },
    {
      "id": "b1744ed2-7b32-4858-ad4d-1156594d54cd",
      "name": "便签 5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1776,
        -112
      ],
      "parameters": {
        "color": 7,
        "width": 256,
        "height": 320,
        "content": "## 创建发票"
      },
      "typeVersion": 1
    },
    {
      "id": "0cb2eea2-6239-47fb-9ec3-41ffd9bf3c41",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2080,
        -112
      ],
      "parameters": {
        "color": 7,
        "width": 256,
        "height": 320,
        "content": "## 发送发票"
      },
      "typeVersion": 1
    },
    {
      "id": "b20793cf-e29a-4fe4-a7b9-72c8d8311820",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1328,
        -416
      ],
      "parameters": {
        "width": 736,
        "height": 880,
        "content": "## 使用 Jotform 和 QuickBooks 为客户生成发票"
      },
      "typeVersion": 1
    },
    {
      "id": "c35659b4-98f2-4b24-882b-7820329962f3",
      "name": "便签8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -240,
        -112
      ],
      "parameters": {
        "color": 7,
        "width": 256,
        "height": 320,
        "content": "## 格式化数据"
      },
      "typeVersion": 1
    },
    {
      "id": "777c7f53-c2c7-486f-8b39-3a545dc15838",
      "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": "b7e7db5f-40e5-4d88-a7fe-508dbe49619f",
      "name": "便签9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        864,
        -112
      ],
      "parameters": {
        "color": 7,
        "width": 256,
        "height": 320,
        "content": "## 添加客户 ID"
      },
      "typeVersion": 1
    },
    {
      "id": "ab0a3406-5106-4c82-b4b9-3972a7ac630d",
      "name": "添加客户 ID",
      "type": "n8n-nodes-base.code",
      "position": [
        944,
        0
      ],
      "parameters": {
        "jsCode": "return {\n  ...$('Format data').first().json,\n  customer: {\n    ...$('Format data').first().json.customer,\n    id: $input.first().json.Id\n  }\n}"
      },
      "typeVersion": 2
    },
    {
      "id": "7167d106-716c-4d5c-bfdc-3d7905523644",
      "name": "便签 10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1472,
        -112
      ],
      "parameters": {
        "color": 7,
        "width": 256,
        "height": 320,
        "content": "## 添加项目 ID"
      },
      "typeVersion": 1
    },
    {
      "id": "a7aff86c-425b-424c-ac2e-135176e43a40",
      "name": "添加项目 ID",
      "type": "n8n-nodes-base.code",
      "position": [
        1552,
        0
      ],
      "parameters": {
        "jsCode": "return {\n  ...$('Add customer id').first().json,\n  item: {\n    ...$('Add customer id').first().json.item,\n    id: $input.first().json.Id\n  }\n}"
      },
      "typeVersion": 2
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "471906c5-a3fb-4975-8a45-800eab74c62f",
  "connections": {
    "6d770cb0-0b36-484c-9c58-46afe7a4bb8a": {
      "main": [
        [
          {
            "node": "d3f307c0-6e27-4212-bd2c-ab585a6ac095",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "8f1d632d-cf26-4bb2-80e9-c019cde28bdb",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a7aff86c-425b-424c-ac2e-135176e43a40": {
      "main": [
        [
          {
            "node": "b13d423b-9fe9-44d2-ac74-93b193a5de1b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "777c7f53-c2c7-486f-8b39-3a545dc15838": {
      "main": [
        [
          {
            "node": "b0b10282-e6a3-459b-ae3d-23a4aeec885b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ab0a3406-5106-4c82-b4b9-3972a7ac630d": {
      "main": [
        [
          {
            "node": "4391d022-ce12-41ab-ab4b-c35143f6ac38",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4391d022-ce12-41ab-ab4b-c35143f6ac38": {
      "main": [
        [
          {
            "node": "a7aff86c-425b-424c-ac2e-135176e43a40",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "b13d423b-9fe9-44d2-ac74-93b193a5de1b": {
      "main": [
        [
          {
            "node": "08437c34-4454-4690-a752-d011945caf5a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "8f1d632d-cf26-4bb2-80e9-c019cde28bdb": {
      "main": [
        [
          {
            "node": "ab0a3406-5106-4c82-b4b9-3972a7ac630d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d3f307c0-6e27-4212-bd2c-ab585a6ac095": {
      "main": [
        [
          {
            "node": "ab0a3406-5106-4c82-b4b9-3972a7ac630d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4f6366d5-b755-4bec-83eb-482efdba74a3": {
      "main": [
        [
          {
            "node": "777c7f53-c2c7-486f-8b39-3a545dc15838",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "b0b10282-e6a3-459b-ae3d-23a4aeec885b": {
      "main": [
        [
          {
            "node": "6d770cb0-0b36-484c-9c58-46afe7a4bb8a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量22
分类-
节点类型5
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

外部链接
在 n8n.io 查看

分享此工作流

分类

分类: 34