PDF 转订单
高级
这是一个Document Extraction, Miscellaneous, Multimodal AI领域的自动化工作流,包含 96 个节点。主要使用 If, Set, Code, Wait, Limit 等节点。 使用AI将PDF采购订单自动化转换为Adobe Commerce销售订单
前置要求
- •可能需要目标 API 的认证凭证
- •OpenAI API Key
使用的节点 (96)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "qfERlqqAvDjUMxQZ",
"meta": {
"instanceId": "965bb8e7bf93f91108971d05aa397ffa90b643c7ff8c03d51df51a28ffdc99dc"
},
"name": "PDF 转订单",
"tags": [],
"nodes": [
{
"id": "9890e277-89bd-4a3a-995f-eb06252cd1f6",
"name": "从文件中提取",
"type": "n8n-nodes-base.extractFromFile",
"disabled": true,
"position": [
128,
1264
],
"parameters": {
"options": {},
"operation": "pdf"
},
"typeVersion": 1
},
{
"id": "395233c3-597c-4704-aa34-95700166f2ee",
"name": "创建购物车",
"type": "n8n-nodes-base.httpRequest",
"position": [
6288,
672
],
"parameters": {
"url": "=https://www.example.com/rest/V1/customers/{{ $('set Customer').item.json.customer.id}}/carts",
"method": "POST",
"options": {},
"authentication": "predefinedCredentialType",
"nodeCredentialType": "magento2Api"
},
"credentials": {
"magento2Api": {
"id": "yGyqOmSuvrgMUFB9",
"name": "Magento 2 PROD"
}
},
"typeVersion": 4.2
},
{
"id": "f2c25774-8c2e-4d83-9029-1ddcec3f1be9",
"name": "表单提交时",
"type": "n8n-nodes-base.formTrigger",
"disabled": true,
"position": [
-96,
1264
],
"webhookId": "107e8046-ec0a-449c-af5f-c2b5c34b7873",
"parameters": {
"options": {},
"formTitle": "PDF",
"formFields": {
"values": [
{
"fieldType": "file",
"fieldLabel": "data",
"multipleFiles": false,
"requiredField": true,
"acceptFileTypes": ".pdf"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "dc25383f-c225-4b9b-a0a3-187281aeb673",
"name": "设置客户",
"type": "n8n-nodes-base.set",
"position": [
5552,
784
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "b86f06ee-7dd4-46ec-a865-cd8312721771",
"name": "customer",
"type": "object",
"value": "={{ $json.items[0] }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "0f4c3f39-7dd7-4f30-a08d-e71d6a7b6522",
"name": "设置报价 ID",
"type": "n8n-nodes-base.set",
"position": [
6560,
672
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "861cd718-14ef-485f-8b32-94702984d310",
"name": "quote_id",
"type": "string",
"value": "={{ $json }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "02230beb-0a2b-4e95-84cb-fbf1fd66ba0c",
"name": "设置账单地址",
"type": "n8n-nodes-base.httpRequest",
"position": [
11696,
656
],
"parameters": {
"url": "=https://www.example.com/rest/V1/carts/{{ $('set Quote Id').first().json.quote_id }}/billing-address",
"method": "POST",
"options": {},
"jsonBody": "={\n \"address\": {\n \"customer_address_id\": {{ $('set Address').first().json.id }}\n },\n \"useForShipping\": true\n}",
"sendBody": true,
"specifyBody": "json",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "magento2Api"
},
"credentials": {
"magento2Api": {
"id": "yGyqOmSuvrgMUFB9",
"name": "Magento 2 PROD"
}
},
"executeOnce": true,
"typeVersion": 4.2
},
{
"id": "6a0265b7-1ced-4d10-a8b6-b904a696097f",
"name": "估算配送方式",
"type": "n8n-nodes-base.httpRequest",
"position": [
11920,
656
],
"parameters": {
"url": "=https://www.example.com/rest/V1/carts/{{ $('set Quote Id').first().json.quote_id }}/estimate-shipping-methods",
"method": "POST",
"options": {},
"jsonBody": "={\n \"address\": {\n \"firstname\": \"{{ $('set Customer').first().json.customer.addresses[0].firstname }}\",\n \"lastname\": \"{{ $('set Customer').first().json.customer.addresses[0].lastname }}\",\n \"street\": {{ JSON.stringify($('set Customer').first().json.customer.addresses[0].street) }},\n \"city\": \"{{ $('set Customer').first().json.customer.addresses[0].city }}\",\n \"postcode\": \"{{ $('set Customer').first().json.customer.addresses[0].postcode }}\",\n \"region\": \"{{ $('set Customer').first().json.customer.addresses[0].region.region }}\",\n \"country_id\": \"{{ $('set Customer').first().json.customer.addresses[0].country_id }}\"\n }\n}\n",
"sendBody": true,
"specifyBody": "json",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "magento2Api"
},
"credentials": {
"magento2Api": {
"id": "yGyqOmSuvrgMUFB9",
"name": "Magento 2 PROD"
}
},
"executeOnce": true,
"typeVersion": 4.2
},
{
"id": "1fe3857b-dc7a-4147-b318-c02f703300d5",
"name": "设置参考编号",
"type": "n8n-nodes-base.httpRequest",
"position": [
13088,
656
],
"parameters": {
"url": "=https://www.example.com/rest/V1/carts/{{ $('set Quote Id').first().json.quote_id }}/set-reference-number",
"method": "PUT",
"options": {},
"jsonBody": "={\n \"number\": \"{{ $('set OpenAI').first().json.content.po_number }}\"\n}",
"sendBody": true,
"specifyBody": "json",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "magento2Api"
},
"credentials": {
"magento2Api": {
"id": "yGyqOmSuvrgMUFB9",
"name": "Magento 2 PROD"
}
},
"executeOnce": true,
"typeVersion": 4.2
},
{
"id": "2908f698-e451-4d37-a3f5-02d7cd88e505",
"name": "设置 OpenAI",
"type": "n8n-nodes-base.set",
"position": [
2016,
1168
],
"parameters": {
"options": {
"ignoreConversionErrors": true
},
"assignments": {
"assignments": [
{
"id": "4501fdd9-135b-4717-92bd-fd591492e0ea",
"name": "content",
"type": "object",
"value": "={{ JSON.parse($json.output) }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "491bd788-b44e-41b9-9c1c-fd58d71bccc8",
"name": "设置订单备注",
"type": "n8n-nodes-base.httpRequest",
"position": [
13312,
656
],
"parameters": {
"url": "=https://www.example.com/rest/V1/carts/{{ $('set Quote Id').first().json.quote_id }}/order-comment",
"method": "PUT",
"options": {},
"jsonBody": "={\n \"comment\": \"The order has been automatically processed\"\n}",
"sendBody": true,
"specifyBody": "json",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "magento2Api"
},
"credentials": {
"magento2Api": {
"id": "yGyqOmSuvrgMUFB9",
"name": "Magento 2 PROD"
}
},
"executeOnce": true,
"typeVersion": 4.2
},
{
"id": "6a9d7577-4008-42ff-a1ab-02a5e8f994d1",
"name": "获取支付方式",
"type": "n8n-nodes-base.httpRequest",
"position": [
13536,
656
],
"parameters": {
"url": "=https://www.example.com/rest/V1/carts/{{ $('set Quote Id').first().json.quote_id }}/payment-methods",
"options": {},
"jsonBody": "={\n \"address\": {\n \"firstname\": \"{{ $('set Customer').first().json.customer.addresses[0].firstname }}\",\n \"lastname\": \"{{ $('set Customer').first().json.customer.addresses[0].lastname }}\",\n \"street\": {{ JSON.stringify($('set Customer').first().json.customer.addresses[0].street) }},\n \"city\": \"{{ $('set Customer').first().json.customer.addresses[0].city }}\",\n \"postcode\": \"{{ $('set Customer').first().json.customer.addresses[0].postcode }}\",\n \"region\": \"{{ $('set Customer').first().json.customer.addresses[0].region.region }}\",\n \"country_id\": \"{{ $('set Customer').first().json.customer.addresses[0].country_id }}\"\n }\n}\n",
"sendBody": true,
"specifyBody": "json",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "magento2Api"
},
"credentials": {
"magento2Api": {
"id": "yGyqOmSuvrgMUFB9",
"name": "Magento 2 PROD"
}
},
"executeOnce": true,
"typeVersion": 4.2
},
{
"id": "6ff7ff4f-dbeb-45f6-8307-25a8e931c1d8",
"name": "聚合",
"type": "n8n-nodes-base.aggregate",
"position": [
11344,
528
],
"parameters": {
"options": {},
"aggregate": "aggregateAllItemData"
},
"typeVersion": 1
},
{
"id": "1249cf58-e268-4039-b3e2-44fdf66b7a82",
"name": "检查公司信用",
"type": "n8n-nodes-base.code",
"position": [
13744,
656
],
"parameters": {
"jsCode": "const items = $input.all(); // get all items\nconst paymentMethods = items.map(i => i.json); // extract JSON from each\n\nconst hasCompanyCredit = paymentMethods.some(method => method.code === 'companycredit');\n\nreturn [{\n json: {\n hasCompanyCredit\n }\n}];\n"
},
"typeVersion": 2
},
{
"id": "e8a9fdec-1d08-41ef-b926-321da7390669",
"name": "当收到聊天消息时",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"disabled": true,
"position": [
-96,
1056
],
"webhookId": "faf3016b-04e2-4a37-816e-7d90c506d18a",
"parameters": {
"options": {
"allowFileUploads": true,
"allowedFilesMimeTypes": "pdf"
}
},
"typeVersion": 1.1
},
{
"id": "79ce029f-ec9c-45ad-b55d-4dbe8c8ec5cd",
"name": "从文件1中提取",
"type": "n8n-nodes-base.extractFromFile",
"disabled": true,
"position": [
128,
1056
],
"parameters": {
"options": {},
"operation": "pdf",
"binaryPropertyName": "data0"
},
"typeVersion": 1
},
{
"id": "d2120bca-773d-4c2e-a404-1e1aad88a198",
"name": "设置地址",
"type": "n8n-nodes-base.code",
"position": [
5712,
784
],
"parameters": {
"jsCode": "const addresses = $json.customer.addresses || [];\n\nconst defaultAddress = addresses.find(addr => addr.default_shipping === true);\n\nreturn [{\n json: {\n ...defaultAddress\n }\n}];\n"
},
"typeVersion": 2
},
{
"id": "05efafa7-bbd0-409b-b1c7-e38030a87030",
"name": "获取可配置产品",
"type": "n8n-nodes-base.httpRequest",
"onError": "continueRegularOutput",
"position": [
7680,
816
],
"parameters": {
"url": "=https://www.example.com/rest/V1/products?searchCriteria[filter_groups][0][filters][0][field]=sku_search&searchCriteria[filter_groups][0][filters][0][value]={{ $json.clean_articlenumber }}&searchCriteria[filter_groups][0][filters][0][condition_type]=eq",
"options": {},
"authentication": "predefinedCredentialType",
"nodeCredentialType": "magento2Api"
},
"credentials": {
"magento2Api": {
"id": "yGyqOmSuvrgMUFB9",
"name": "Magento 2 PROD"
}
},
"typeVersion": 4.2
},
{
"id": "72eca58d-c3e0-47c9-82d7-3dff8207fbde",
"name": "如果公司信用",
"type": "n8n-nodes-base.if",
"position": [
13968,
656
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "e2a48e26-f9ee-4b4b-84c5-f4b1759a4474",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $json.hasCompanyCredit }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "180a1faf-014b-41ec-a1e8-e6cf36ca9263",
"name": "合并",
"type": "n8n-nodes-base.merge",
"position": [
7904,
688
],
"parameters": {
"mode": "combine",
"options": {},
"combineBy": "combineByPosition"
},
"typeVersion": 3.1
},
{
"id": "736d887a-006d-4aa3-b4ba-4344ba00aea8",
"name": "设置快递配送方式",
"type": "n8n-nodes-base.httpRequest",
"position": [
12576,
752
],
"parameters": {
"url": "=https://www.example.com/rest/V1/carts/{{ $('set Quote Id').first().json.quote_id }}/shipping-information",
"method": "POST",
"options": {},
"jsonBody": "={\n \"addressInformation\": {\n \"shipping_address\": {\n \"customer_address_id\": {{ $('set Customer').first().json.customer.addresses[0].id }},\n \"country_id\": \"{{ $('set Customer').first().json.customer.addresses[0].country_id }}\"\n },\n \"shipping_carrier_code\": \"{{ $input.last().json.carrier_code }}\",\n \"shipping_method_code\": \"{{ $input.last().json.method_code}}\"\n }\n}",
"sendBody": true,
"specifyBody": "json",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "magento2Api"
},
"credentials": {
"magento2Api": {
"id": "yGyqOmSuvrgMUFB9",
"name": "Magento 2 PROD"
}
},
"executeOnce": true,
"typeVersion": 4.2
},
{
"id": "12b39d6f-1265-4134-8c33-53b8629a01b7",
"name": "限制",
"type": "n8n-nodes-base.limit",
"position": [
12144,
656
],
"parameters": {
"maxItems": 2
},
"typeVersion": 1
},
{
"id": "44611b16-16a4-4a21-a73d-15a9d022239b",
"name": "设置标准配送方式",
"type": "n8n-nodes-base.httpRequest",
"position": [
12576,
544
],
"parameters": {
"url": "=https://www.example.com/rest/V1/carts/{{ $('set Quote Id').first().json.quote_id }}/shipping-information",
"method": "POST",
"options": {},
"jsonBody": "={\n \"addressInformation\": {\n \"shipping_address\": {\n \"customer_address_id\": {{ $('set Customer').first().json.customer.addresses[0].id }},\n \"country_id\": \"{{ $('set Customer').first().json.customer.addresses[0].country_id }}\"\n },\n \"shipping_carrier_code\": \"{{ $input.first().json.carrier_code }}\",\n \"shipping_method_code\": \"{{ $input.first().json.method_code}}\"\n }\n}",
"sendBody": true,
"specifyBody": "json",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "magento2Api"
},
"credentials": {
"magento2Api": {
"id": "yGyqOmSuvrgMUFB9",
"name": "Magento 2 PROD"
}
},
"executeOnce": true,
"typeVersion": 4.2
},
{
"id": "384255bb-4301-4a4d-a08e-b25cf8f8c13c",
"name": "设置反馈",
"type": "n8n-nodes-base.set",
"position": [
6144,
1936
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "7d430e2c-bc0f-4f7a-a718-e0f4a0e21a51",
"name": "message",
"type": "string",
"value": "=No customers found in the webshop with emailadresses: {{ $('filter Emailadresses').item.json.content.email }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "fa659e1c-24ec-4540-b973-115a998a8bb4",
"name": "设置清理后的商品编号",
"type": "n8n-nodes-base.set",
"position": [
7440,
672
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "1f4f162f-225c-41ae-b985-ae8962e6cccf",
"name": "clean_articlenumber",
"type": "string",
"value": "={{ $json.articlenumber.replace(/[^a-zA-Z0-9]/g, '') }}"
}
]
},
"includeOtherFields": true
},
"typeVersion": 3.4
},
{
"id": "6a43fd7f-c7fb-4365-815f-315028af24b0",
"name": "获取购物车商品",
"type": "n8n-nodes-base.httpRequest",
"position": [
6912,
480
],
"parameters": {
"url": "=https://www.example.com/rest/V1/carts/{{ $json.quote_id }}/items",
"options": {},
"authentication": "predefinedCredentialType",
"nodeCredentialType": "magento2Api"
},
"credentials": {
"magento2Api": {
"id": "yGyqOmSuvrgMUFB9",
"name": "Magento 2 PROD"
}
},
"typeVersion": 4.2
},
{
"id": "81a33420-77c6-4986-a1b4-84d222b7fc7f",
"name": "从购物车中移除",
"type": "n8n-nodes-base.httpRequest",
"position": [
7136,
480
],
"parameters": {
"url": "=https://www.example.com/rest/V1/carts/{{ $json.quote_id }}/items/{{ $json.item_id }}",
"method": "DELETE",
"options": {},
"authentication": "predefinedCredentialType",
"nodeCredentialType": "magento2Api"
},
"credentials": {
"magento2Api": {
"id": "yGyqOmSuvrgMUFB9",
"name": "Magento 2 PROD"
}
},
"typeVersion": 4.2
},
{
"id": "28409228-4cc4-47f0-be65-b4f1a94d7b8e",
"name": "获取购物车商品1",
"type": "n8n-nodes-base.httpRequest",
"onError": "continueRegularOutput",
"position": [
14416,
112
],
"parameters": {
"url": "=https://www.example.com/rest/V1/carts/{{ parseFloat($('set Quote Id').item.json.quote_id) }}/items",
"options": {},
"authentication": "predefinedCredentialType",
"nodeCredentialType": "magento2Api"
},
"credentials": {
"magento2Api": {
"id": "yGyqOmSuvrgMUFB9",
"name": "Magento 2 PROD"
}
},
"typeVersion": 4.2
},
{
"id": "2f6e189d-c322-43a1-83a9-3a3ca8f34567",
"name": "从购物车中移除1",
"type": "n8n-nodes-base.httpRequest",
"onError": "continueRegularOutput",
"position": [
14640,
112
],
"parameters": {
"url": "=https://www.example.com/rest/V1/carts/{{ $json.quote_id }}/items/{{ $json.item_id }}",
"method": "DELETE",
"options": {},
"authentication": "predefinedCredentialType",
"nodeCredentialType": "magento2Api"
},
"credentials": {
"magento2Api": {
"id": "yGyqOmSuvrgMUFB9",
"name": "Magento 2 PROD"
}
},
"typeVersion": 4.2
},
{
"id": "f378aa93-9039-4003-aba8-466f9f32abfd",
"name": "如果默认地址",
"type": "n8n-nodes-base.if",
"position": [
5872,
784
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "and",
"conditions": [
{
"id": "fd484e2d-1124-4e78-a62a-efb39095b107",
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.id }}",
"rightValue": ""
}
]
},
"looseTypeValidation": true
},
"typeVersion": 2.2
},
{
"id": "92de4eba-62fd-4314-a15d-ebcd4d0440b0",
"name": "设置默认地址反馈",
"type": "n8n-nodes-base.set",
"position": [
6144,
1744
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "7d430e2c-bc0f-4f7a-a718-e0f4a0e21a51",
"name": "message",
"type": "string",
"value": "=No default address found for customer {{ $('set Customer').item.json.customer.email }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "210ebce0-2feb-4bac-9b69-92f2848db0ed",
"name": "切换",
"type": "n8n-nodes-base.switch",
"position": [
2944,
944
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "Company1",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "40cc7660-de4b-49cc-8ff2-cbca3e3d77b6",
"operator": {
"type": "string",
"operation": "contains"
},
"leftValue": "={{ $json.content.address.company_name }}",
"rightValue": "Company 1"
}
]
},
"renameOutput": true
},
{
"outputKey": "Customer",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "91a71674-3d80-4b59-a1de-020fde68bbbd",
"operator": {
"type": "string",
"operation": "contains"
},
"leftValue": "={{ JSON.stringify($json.content.email) }}",
"rightValue": "@customer.com"
}
]
},
"renameOutput": true
}
]
},
"options": {
"fallbackOutput": "extra"
}
},
"typeVersion": 3.2
},
{
"id": "7cb9f161-8a1e-4888-bdac-7249612472e5",
"name": "从文件提取2",
"type": "n8n-nodes-base.extractFromFile",
"position": [
816,
832
],
"parameters": {
"options": {},
"operation": "pdf",
"binaryPropertyName": "attachment"
},
"typeVersion": 1
},
{
"id": "528b43cb-d102-4773-9801-200e4e96cba5",
"name": "停止和错误1",
"type": "n8n-nodes-base.stopAndError",
"position": [
15264,
2048
],
"parameters": {
"errorMessage": "={{ $json.message }}"
},
"typeVersion": 1
},
{
"id": "1ca9c9d2-5e09-445c-b1da-d67e9f56af7b",
"name": "无操作,不执行任何操作",
"type": "n8n-nodes-base.noOp",
"position": [
1248,
1168
],
"parameters": {},
"typeVersion": 1
},
{
"id": "bcfa313b-0206-4212-be8b-e58d11dfc077",
"name": "JSON 错误消息",
"type": "n8n-nodes-base.set",
"position": [
15040,
2048
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "6bd733dc-147d-401f-9399-4d8cdf85190a",
"name": "message",
"type": "string",
"value": "={{ JSON.stringify($json) }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "150f9f98-f67b-47ab-9f88-83ea2e55fc1b",
"name": "合并错误字段",
"type": "n8n-nodes-base.set",
"position": [
14816,
2048
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "dc806cb3-a93c-4520-86d1-7e7e948b269d",
"name": "message",
"type": "string",
"value": "={{ $json.message }}"
},
{
"id": "f8f9d4dd-6de8-4d3d-9c38-971f870dd8be",
"name": "email_id",
"type": "string",
"value": "={{ $('Email combine').first().json.id }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "fc4c479f-7e30-4e25-ad5c-1ede51dc7c33",
"name": "无操作,不执行任何操作1",
"type": "n8n-nodes-base.noOp",
"position": [
12032,
1952
],
"parameters": {},
"typeVersion": 1
},
{
"id": "aa105f7b-cc4a-4430-afdd-a3e3a26365de",
"name": "设置成功消息",
"type": "n8n-nodes-base.set",
"disabled": true,
"position": [
14864,
112
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "0385f122-a92b-4061-b5fb-10d27ad59dff",
"name": "message",
"type": "string",
"value": "Everything good, cart cleared"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "838353b2-48bf-4eef-80bd-4ea7a2bb2522",
"name": "设置空邮箱消息",
"type": "n8n-nodes-base.set",
"position": [
3024,
2144
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "50596fcc-fd14-4554-88a7-919c9826b68b",
"name": "message",
"type": "string",
"value": "No emailaddresses found in PDF"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "a4e45594-4286-4f68-8f21-6c00100e8336",
"name": "设置空产品消息",
"type": "n8n-nodes-base.set",
"position": [
3024,
1936
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "50596fcc-fd14-4554-88a7-919c9826b68b",
"name": "message",
"type": "string",
"value": "No products found in PDF"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "136e83aa-750d-4c0d-938a-e470de35e5e6",
"name": "产品不为空",
"type": "n8n-nodes-base.if",
"position": [
2688,
1072
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "890a4093-c76d-4667-99f2-d045ce4ee440",
"operator": {
"type": "array",
"operation": "lengthGte",
"rightType": "number"
},
"leftValue": "={{ $json.content.products }}",
"rightValue": 1
}
]
}
},
"typeVersion": 2.2
},
{
"id": "b65ce8b3-f91f-4c1f-9bcd-7fcc6158ece0",
"name": "邮箱不为空",
"type": "n8n-nodes-base.if",
"position": [
2464,
1168
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "176ded4d-8dce-4149-9303-67a39a7c10b5",
"operator": {
"type": "number",
"operation": "gte"
},
"leftValue": "={{ $json.content.email.length }}",
"rightValue": 1
}
]
}
},
"typeVersion": 2.2
},
{
"id": "354d7cd2-3cc4-40b8-8e9c-95e9579715a4",
"name": "设置信息",
"type": "n8n-nodes-base.set",
"position": [
1024,
832
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "8cf26a57-2a4f-4b12-bb62-032be07ff461",
"name": "info",
"type": "string",
"value": "={{ $('Email combine').first().json.text }}\n{{ $json.text }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "76a4df77-73b6-4ee1-be21-7429a5a743bb",
"name": "设置信息 2",
"type": "n8n-nodes-base.set",
"disabled": true,
"position": [
352,
1168
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "8b70af92-d07d-4002-8d8d-b22f6d06d55c",
"name": "info",
"type": "string",
"value": "=jellekingm@gmail.com\n{{ $json.text }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "df152c99-cb59-41ae-ac76-0429d1531767",
"name": "赊账支付错误消息",
"type": "n8n-nodes-base.set",
"position": [
14480,
1680
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "50596fcc-fd14-4554-88a7-919c9826b68b",
"name": "message",
"type": "string",
"value": "No pay on account for this client"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "8888ccf9-b3ea-44e9-a50a-c6cb827ff423",
"name": "设置空采购订单号消息",
"type": "n8n-nodes-base.set",
"position": [
4224,
1808
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "50596fcc-fd14-4554-88a7-919c9826b68b",
"name": "message",
"type": "string",
"value": "No PO number found in PDF"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "7a0daa68-cf6c-4fce-b0b2-fdc4c6aa92a0",
"name": "如果采购订单号不为空",
"type": "n8n-nodes-base.if",
"position": [
3744,
992
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "a9233974-706e-4cfb-b382-737d35c02ed5",
"operator": {
"type": "string",
"operation": "notEmpty",
"singleValue": true
},
"leftValue": "={{ $json.content.po_number }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "521ca2ab-920f-4092-86e6-69fa938c2469",
"name": "流程编号",
"type": "n8n-nodes-base.set",
"position": [
3184,
672
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "2cca615c-aae6-43b5-ab3e-f98e4dabd68a",
"name": "content.po_number",
"type": "string",
"value": "={{ $json.content.extra_fields.Vorgangsnummer }}"
}
]
},
"includeOtherFields": true
},
"typeVersion": 3.4
},
{
"id": "338aa109-d64a-4667-92b9-206c973fb68e",
"name": "无操作,不执行任何操作3",
"type": "n8n-nodes-base.noOp",
"position": [
5792,
2160
],
"parameters": {},
"typeVersion": 1
},
{
"id": "1df3130a-94c7-40ea-a214-78a46a420a68",
"name": "拆分出产品",
"type": "n8n-nodes-base.splitOut",
"position": [
7200,
672
],
"parameters": {
"options": {},
"fieldToSplitOut": "=products"
},
"typeVersion": 1
},
{
"id": "5b4e4cd7-e891-4466-b9f1-396b7cfb4c8c",
"name": "代码",
"type": "n8n-nodes-base.code",
"position": [
592,
832
],
"parameters": {
"jsCode": "const results = [];\n\nfor (const item of items) {\n for (const key in item.binary) {\n if (\n Object.prototype.hasOwnProperty.call(item.binary, key) &&\n (item.binary[key].mimeType === 'application/pdf' || (item.binary[key].mimeType === 'application/octet-stream' && item.binary[key].fileExtension === 'pdf') )\n ) {\n results.push({\n json: {\n attachmentName: key\n },\n binary: {\n [\"attachment\"]: item.binary[key]\n }\n });\n }\n }\n}\n\nreturn results;\n"
},
"typeVersion": 2
},
{
"id": "9594d9ef-a7b3-4c92-b137-85e44bc7bd0e",
"name": "获取产品",
"type": "n8n-nodes-base.set",
"position": [
6912,
672
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "77c75b9c-b29d-489d-b340-2531eda02bb3",
"name": "products",
"type": "array",
"value": "={{ $('Products').first().json.content.products }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "1f0bc0cc-0813-4ca2-9aad-0033c809a2e6",
"name": "执行工作流",
"type": "n8n-nodes-base.executeWorkflow",
"position": [
9552,
784
],
"parameters": {
"mode": "each",
"options": {
"waitForSubWorkflow": true
},
"workflowId": {
"__rl": true,
"mode": "list",
"value": "1PVo1WneDnBPX8l3",
"cachedResultName": "Klippa - add to cart"
},
"workflowInputs": {
"value": {},
"schema": [],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": true
}
},
"typeVersion": 1.2,
"alwaysOutputData": true
},
{
"id": "f6317816-efa3-494b-a8d8-74bd5ef768f4",
"name": "等待",
"type": "n8n-nodes-base.wait",
"position": [
9744,
784
],
"webhookId": "8f84d918-7a74-4fdc-9e28-3a9a222c8e59",
"parameters": {
"amount": 2
},
"typeVersion": 1.1
},
{
"id": "2d08b11b-d4cb-41de-a8ed-4962ba1a8b8f",
"name": "合并1",
"type": "n8n-nodes-base.merge",
"position": [
9136,
544
],
"parameters": {
"mode": "combine",
"options": {},
"combineBy": "combineByPosition"
},
"typeVersion": 3.1
},
{
"id": "a4480866-98a0-45ad-94d0-0d806cb79a46",
"name": "下订单",
"type": "n8n-nodes-base.httpRequest",
"position": [
14464,
576
],
"parameters": {
"url": "=https://www.example.com/rest/V1/carts/{{ $('set Quote Id').first().json.quote_id }}/order",
"method": "PUT",
"options": {},
"jsonBody": "={\n \"paymentMethod\": {\n \"method\": \"companycredit\"\n }\n}",
"sendBody": true,
"specifyBody": "json",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "magento2Api"
},
"credentials": {
"magento2Api": {
"id": "yGyqOmSuvrgMUFB9",
"name": "Magento 2 PROD"
}
},
"executeOnce": true,
"typeVersion": 4.2
},
{
"id": "1d589a8b-fcdb-4f8f-940a-41ac846ff0e0",
"name": "过滤邮箱地址",
"type": "n8n-nodes-base.code",
"position": [
2240,
1168
],
"parameters": {
"jsCode": "const content = $json.content;\nconst emails = $input.first().json.content.email ?? [];\nconst filteredEmails = emails.filter(email => !email.toLowerCase().includes('@example.com'));\nconst updatedContent = {\n ...content,\n email: filteredEmails\n};\n\nreturn [{\n json: {\n content: updatedContent\n }\n}];"
},
"typeVersion": 2
},
{
"id": "af09e1cb-7445-4282-8d42-21dc46c2f045",
"name": "移除 SCH",
"type": "n8n-nodes-base.code",
"position": [
3184,
848
],
"parameters": {
"jsCode": "return items.map(item => {\n // veilige clone (ook van json) zodat we het origineel niet muteren\n const newItem = { ...item, json: { ...item.json } };\n\n const content = newItem.json.content || {};\n const srcProducts = Array.isArray(content.products) ? content.products : [];\n\n // bewerk elke productregel\n const newProducts = srcProducts.map(p => {\n const product = { ...p };\n let num = product.articlenumber;\n\n if (typeof num === 'string') {\n // trim en case-insensitive check\n const trimmed = num.trim();\n if (trimmed.toUpperCase().startsWith('SCH')) {\n // verwijder alleen de eerste 3 tekens (de 'SCH' prefix)\n product.articlenumber = trimmed.substring(3);\n } else {\n product.articlenumber = trimmed; // normaliseer zonder prefix\n }\n }\n\n return product;\n });\n\n // zet terug in content.products\n newItem.json.content = { ...content, products: newProducts };\n\n return newItem;\n});"
},
"typeVersion": 2
},
{
"id": "c5239a47-4d29-41bf-a109-cdfc22bbeb6b",
"name": "无操作,不执行任何操作4",
"type": "n8n-nodes-base.noOp",
"position": [
10432,
1088
],
"parameters": {},
"typeVersion": 1
},
{
"id": "52a5fb8a-0462-4e97-a1c0-da6e8fc0bb79",
"name": "设置可配置产品反馈",
"type": "n8n-nodes-base.set",
"position": [
8672,
1072
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "7d430e2c-bc0f-4f7a-a718-e0f4a0e21a51",
"name": "message",
"type": "string",
"value": "=No product found with sku: \n{{ $json.articlenumber }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "a1d68621-d2ca-44ee-9ebc-67dc85dab044",
"name": "通过采购订单号获取订单",
"type": "n8n-nodes-base.httpRequest",
"position": [
3984,
928
],
"parameters": {
"url": "=https://www.example.com/rest/V1/orders?searchCriteria[filterGroups][0][filters][0][conditionType]=eq&searchCriteria[filterGroups][0][filters][0][field]=custom_reference_number&searchCriteria[filterGroups][0][filters][0][value]={{ $json.content.po_number }}",
"options": {},
"authentication": "predefinedCredentialType",
"nodeCredentialType": "magento2Api"
},
"credentials": {
"magento2Api": {
"id": "yGyqOmSuvrgMUFB9",
"name": "Magento 2 PROD"
}
},
"typeVersion": 4.2
},
{
"id": "545040e0-790e-4904-8d73-6c05c952459d",
"name": "设置空采购订单号消息1",
"type": "n8n-nodes-base.set",
"position": [
4464,
1664
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "50596fcc-fd14-4554-88a7-919c9826b68b",
"name": "message",
"type": "string",
"value": "PO number already exists in Magento"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "81fcce51-167a-4f2b-8c55-d6d5a8e15614",
"name": "如果采购订单号不存在",
"type": "n8n-nodes-base.if",
"position": [
4192,
928
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "83de1941-269f-46db-82e4-fd4945887cb6",
"operator": {
"type": "number",
"operation": "equals"
},
"leftValue": "={{ $json.total_count }}",
"rightValue": 0
}
]
}
},
"typeVersion": 2.2
},
{
"id": "d19b78d3-428d-471a-aa6f-be6a3b48e7f3",
"name": "Microsoft Outlook 触发器",
"type": "n8n-nodes-base.microsoftOutlookTrigger",
"position": [
-80,
832
],
"parameters": {
"output": "raw",
"filters": {
"foldersToInclude": [
"AAMkADc5ZDM1NjExLWUyMmEtNGFjNS1iZjQ0LWQ1NDIzNjIwM2JhYgAuAAAAAADhdXAyhBkYQ7FZ5j1Q8N6TAQDWbfNIjjgwSYEfigJmM_e_AAAAAAEMAAA="
]
},
"options": {
"downloadAttachments": true
},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
}
},
"credentials": {
"microsoftOutlookOAuth2Api": {
"id": "u58VRn2K8b0NAng2",
"name": "Outlook orders@jc-electronics.nl"
}
},
"typeVersion": 1
},
{
"id": "8aeda9ee-3bb7-4bf6-bd10-fa255e55fa2a",
"name": "设置文本",
"type": "n8n-nodes-base.set",
"position": [
128,
832
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "fa169825-4f61-4185-8382-1e7760219241",
"name": "text",
"type": "string",
"value": "={{ $json.body.content }}"
}
]
},
"includeOtherFields": true
},
"typeVersion": 3.4
},
{
"id": "fe530607-22d6-47e9-8496-136b67939e6d",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
1648,
1168
],
"parameters": {
"text": "=Please extract the following information from the text as valid json.:\n\n\"email\" (array with all email adresses found. Add ALL found email addresses!)\n\"po_number\"\n\"express\" (true or false when express shipping is requested)\n\n\"address\" (skip any address from ourselves, ...), which contains the following fields:\n\"first_name\" (dash if empty)\n\"last_name\" (dash if empty)\n\"company_name\"\n\"street\" (without housenumber)\n\"housenumber\"\n\"zipcode\"\n\"city\" (make sure this city really exist in the country that is also extracted)\n\"country_code\": 2 digit country code\n\"phone_number\": can only contains a + in the beginning, dashes or spaces. Remove any other characters!\n\nAn array with \"products\" that contains:\narticlenumber: Remove any addition Extract the line items from the following purchase order text, making sure to include the full article number exactly as it appears in the text — including any leading characters or digits. Do not omit or alter any part of the article number. \nquantity\nprice\n\nAfter all the products, add ALL extra fields and their values in their original language when found within an object \"extra_fields\"!\n\nThis is a template of how the output should be:\n{\n \"email\": [\n \"\"\n ],\n \"po_number\": \"\",\n \"express\": true,\n \"address\": {\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"company_name\": \"\",\n \"street\": \"\",\n \"housenumber\": \"\",\n \"zipcode\": \"\",\n \"city\": \"\",\n \"country_code\": \"\",\n \"phone_number\": \"\"\n },\n \"products\": [\n {\n \"articlenumber\": \"\",\n \"condition\": \"\",\n \"quantity\": 2,\n \"price\": 1455.75\n }\n ],\n \"extra_fields\": { }\n}\n\nThis is the information:\n{{ $json.info }}",
"options": {},
"promptType": "define"
},
"typeVersion": 2.1
},
{
"id": "4dc910d3-4288-4891-b188-b8a2782cf930",
"name": "移动消息",
"type": "n8n-nodes-base.microsoftOutlook",
"position": [
14912,
576
],
"webhookId": "778df66b-207d-4bdf-a9f8-51b755fef6bd",
"parameters": {
"folderId": {
"__rl": true,
"mode": "list",
"value": "AAMkADc5ZDM1NjExLWUyMmEtNGFjNS1iZjQ0LWQ1NDIzNjIwM2JhYgAuAAAAAADhdXAyhBkYQ7FZ5j1Q8N6TAQDWbfNIjjgwSYEfigJmM_e_AAC4Oo2sAAA=",
"cachedResultUrl": "https://outlook.office365.com/mail/AAMkADc5ZDM1NjExLWUyMmEtNGFjNS1iZjQ0LWQ1NDIzNjIwM2JhYgAuAAAAAADhdXAyhBkYQ7FZ5j1Q8N6TAQDWbfNIjjgwSYEfigJmM_e_AAC4Oo2sAAA%3D",
"cachedResultName": "processed orders"
},
"messageId": {
"__rl": true,
"mode": "id",
"value": "={{ $('Email combine').first().json.id }}"
},
"operation": "move"
},
"credentials": {
"microsoftOutlookOAuth2Api": {
"id": "u58VRn2K8b0NAng2",
"name": "Outlook orders@jc-electronics.nl"
}
},
"typeVersion": 2
},
{
"id": "5de7e170-6b63-445f-af9c-2a5e9b8b2cc3",
"name": "无操作,不执行任何操作2",
"type": "n8n-nodes-base.noOp",
"position": [
5408,
1728
],
"parameters": {},
"typeVersion": 1
},
{
"id": "f702cbea-aa85-45c0-a7bf-630971cf6286",
"name": "获取客户",
"type": "n8n-nodes-base.httpRequest",
"position": [
5168,
928
],
"parameters": {
"url": "=https://www.example.com/rest/V1/customers/search?searchCriteria[filterGroups][0][filters][0][conditionType]=eq&searchCriteria[filterGroups][0][filters][0][field]=email&searchCriteria[filterGroups][0][filters][0][value]={{ $json.email.trim() }}&searchCriteria[filterGroups][1][filters][0][conditionType]=eq\n&searchCriteria[filterGroups][1][filters][0][field]=website_id\n&searchCriteria[filterGroups][1][filters][0][value]=1&searchCriteria[pageSize]=1",
"options": {},
"authentication": "predefinedCredentialType",
"nodeCredentialType": "magento2Api"
},
"credentials": {
"magento2Api": {
"id": "yGyqOmSuvrgMUFB9",
"name": "Magento 2 PROD"
}
},
"typeVersion": 4.2
},
{
"id": "0fb6677d-e26d-4373-b2a4-318950742b8e",
"name": "如果客户",
"type": "n8n-nodes-base.if",
"position": [
5344,
928
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "28934991-2b90-46fe-873d-58ba9303fcd0",
"operator": {
"type": "number",
"operation": "equals"
},
"leftValue": "={{ $('get Customer').first().json.total_count }}",
"rightValue": 1
}
]
}
},
"typeVersion": 2.2
},
{
"id": "94f319fe-7e02-47b7-b6fc-07f882fb51f3",
"name": "产品",
"type": "n8n-nodes-base.noOp",
"position": [
3456,
992
],
"parameters": {},
"typeVersion": 1
},
{
"id": "5d76163c-e4e0-4701-b7f4-fce91e26793f",
"name": "便签 - 触发器与输入",
"type": "n8n-nodes-base.stickyNote",
"position": [
-160,
-16
],
"parameters": {
"color": 4,
"width": 1568,
"height": 2592,
"content": "# 📩 1. 触发器与输入"
},
"typeVersion": 1
},
{
"id": "d92ce0d3-e32a-42f2-9203-0d271163584f",
"name": "便签 - AI 解析",
"type": "n8n-nodes-base.stickyNote",
"position": [
1440,
-16
],
"parameters": {
"color": 6,
"width": 2960,
"height": 1584,
"content": "# 📝 AI 解析、标准化与检查"
},
"typeVersion": 1
},
{
"id": "faaae4e9-a753-43ab-b158-4a7cba1fec9d",
"name": "便签 - 客户验证",
"type": "n8n-nodes-base.stickyNote",
"position": [
4448,
-16
],
"parameters": {
"color": 2,
"width": 1664,
"height": 1584,
"content": "# 👤 客户验证"
},
"typeVersion": 1
},
{
"id": "ba367cd6-adc9-40ea-b541-1f971c4568ab",
"name": "便签 - 购物车创建",
"type": "n8n-nodes-base.stickyNote",
"position": [
6160,
-16
],
"parameters": {
"color": 5,
"width": 5008,
"height": 1584,
"content": "# 🛒 购物车创建与产品"
},
"typeVersion": 1
},
{
"id": "52c35a3c-a624-45c3-8c88-bf1985665879",
"name": "便签 - 配送与账单",
"type": "n8n-nodes-base.stickyNote",
"position": [
11184,
-16
],
"parameters": {
"color": 6,
"width": 1776,
"height": 1584,
"content": "# 🚚 配送与账单"
},
"typeVersion": 1
},
{
"id": "de3a1ffb-d421-4218-8b4b-c4df4f334397",
"name": "便签 - 完成订单",
"type": "n8n-nodes-base.stickyNote",
"position": [
12992,
-16
],
"parameters": {
"color": 4,
"width": 2528,
"height": 1584,
"content": "# ✅ 完成订单"
},
"typeVersion": 1
},
{
"id": "d0d18335-f840-498e-be2b-edb3e8b2bdae",
"name": "便签 - 错误处理1",
"type": "n8n-nodes-base.stickyNote",
"position": [
1440,
1600
],
"parameters": {
"color": 3,
"width": 14080,
"height": 976,
"content": "# ⚠️ 错误处理"
},
"typeVersion": 1
},
{
"id": "a9745dc5-5bcf-4414-9cb0-7e035859c792",
"name": "Azure OpenAI 聊天模型1",
"type": "@n8n/n8n-nodes-langchain.lmChatAzureOpenAi",
"position": [
1648,
1408
],
"parameters": {
"model": "model-router",
"options": {
"responseFormat": "json_object"
}
},
"credentials": {
"azureOpenAiApi": {
"id": "h70WE7Hm1hTGuZxy",
"name": "Azure Open AI account Anno"
}
},
"typeVersion": 1
},
{
"id": "5513ca36-a813-4136-8c4e-e4dda5fae7a9",
"name": "循环直到找到现有客户",
"type": "n8n-nodes-base.splitInBatches",
"position": [
4912,
912
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "389b4f77-2cc6-48d1-b547-7910903aaef4",
"name": "如果找到可配置产品",
"type": "n8n-nodes-base.if",
"position": [
8160,
688
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "7be16b31-66d4-402e-801d-b8ad9ce4624e",
"operator": {
"type": "number",
"operation": "equals"
},
"leftValue": "={{ $json.total_count }}",
"rightValue": 1
}
]
}
},
"typeVersion": 2.2
},
{
"id": "754c7b4c-4f07-481d-9108-186a6e588c5e",
"name": "准备 SKU 和报价",
"type": "n8n-nodes-base.set",
"position": [
8480,
672
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "ecb9f0e5-4452-49f6-b224-7394ecd097d4",
"name": "sku",
"type": "string",
"value": "={{ $json.items[0].sku }}"
},
{
"id": "6714cc81-bfa6-450d-a202-759485205490",
"name": "quote_id",
"type": "string",
"value": "={{ $('set Quote Id').first().json.quote_id }}"
}
]
},
"includeOtherFields": true
},
"typeVersion": 3.4
},
{
"id": "783ffc5c-8107-47c7-a703-6d4bc6550c3c",
"name": "如果产品在购物车中",
"type": "n8n-nodes-base.if",
"position": [
9552,
544
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "and",
"conditions": [
{
"id": "10555ad1-148f-496b-9198-dd69b1cfc54a",
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.item_id }}",
"rightValue": ""
}
]
},
"looseTypeValidation": true
},
"typeVersion": 2.2
},
{
"id": "01ee82fd-75f5-4471-b0b3-4523ce827ce0",
"name": "遍历产品",
"type": "n8n-nodes-base.splitInBatches",
"position": [
8912,
672
],
"parameters": {
"options": {
"reset": false
}
},
"typeVersion": 3
},
{
"id": "d33241a7-592e-4386-8dd7-787d41d5744c",
"name": "合并已处理的 SKU",
"type": "n8n-nodes-base.code",
"position": [
10352,
688
],
"parameters": {
"jsCode": "const output = items.map(item => {\n const sku = item.json.items[0].sku;\n const price = item.json.price;\n return `\\n${sku}: €${price}`;\n});\n\nreturn [\n {\n json: {\n combined: output.join(\", \")\n }\n }\n];\n"
},
"typeVersion": 2
},
{
"id": "cf0fd160-d2a5-4f71-bca6-8fab70d4a734",
"name": "合并失败的 SKU",
"type": "n8n-nodes-base.code",
"position": [
10352,
832
],
"parameters": {
"jsCode": "const output = items.map(item => {\n const sku = item.json.items[0].sku;\n const price = item.json.price;\n return `\\n${sku}: €${price}`;\n});\n\nreturn [\n {\n json: {\n combined: output.join(\", \")\n }\n }\n];\n"
},
"typeVersion": 2
},
{
"id": "92cfc8a1-d480-4ddb-8e52-9fde4ad458b2",
"name": "设置失败反馈",
"type": "n8n-nodes-base.set",
"position": [
10560,
832
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "7d430e2c-bc0f-4f7a-a718-e0f4a0e21a51",
"name": "message",
"type": "string",
"value": "=No product with specified price found, or requested stock is not available for sku(s):\n{{ $json.combined }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "aa70d781-e980-4072-86b4-13e57028d4c4",
"name": "设置已处理反馈",
"type": "n8n-nodes-base.set",
"position": [
10560,
688
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "7d430e2c-bc0f-4f7a-a718-e0f4a0e21a51",
"name": "message",
"type": "string",
"value": "=The following product(s) are added to the order:\n{{ $json.combined }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "c61ed836-43ce-4f36-aa1a-d35fb88a60f6",
"name": "合并反馈",
"type": "n8n-nodes-base.code",
"position": [
10752,
832
],
"parameters": {
"jsCode": "let input1 = null;\nlet input2 = null;\nlet input3 = null;\n\nif ($node[\"set Feedback failed\"].runIndex !== -1 || $node[\"set Feedback configurable\"].runIndex !== -1) {\n \n if ($node[\"set Feedback processed\"].runIndex !== -1) {\n input1 = $node[\"set Feedback processed\"].json.message;\n }\n \n if ($node[\"set Feedback failed\"].runIndex !== -1) {\n input2 = $node[\"set Feedback failed\"].json.message;\n }\n \n if ($node[\"set Feedback configurable\"].runIndex !== -1) {\n input3 = $node[\"set Feedback configurable\"].json.message;\n }\n \n const messages = [input1, input2, input3].filter(Boolean);\n \n return [\n {\n json: {\n message: messages.join(\"\\n\\n\")\n }\n }\n ];\n}\nreturn [];"
},
"typeVersion": 2
},
{
"id": "65a9e568-9028-492c-9825-3f05055dd0bd",
"name": "保留 1",
"type": "n8n-nodes-base.limit",
"position": [
11200,
1792
],
"parameters": {
"keep": "lastItems"
},
"typeVersion": 1
},
{
"id": "ab7996fa-0563-4645-898a-1b122bc970af",
"name": "如果是快递",
"type": "n8n-nodes-base.if",
"position": [
12368,
656
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "22a9eef8-b4b6-407a-a79f-0e3325722973",
"operator": {
"type": "boolean",
"operation": "false",
"singleValue": true
},
"leftValue": "={{ $('set OpenAI').first().json.content.express }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "1353dc3b-85a1-4adf-bcc7-d0c397903ebd",
"name": "拆分邮箱",
"type": "n8n-nodes-base.splitOut",
"position": [
4704,
912
],
"parameters": {
"options": {},
"fieldToSplitOut": "=email"
},
"typeVersion": 1
},
{
"id": "f27efa95-baed-423a-87de-367c1c5002d7",
"name": "设置邮箱",
"type": "n8n-nodes-base.set",
"position": [
4528,
912
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "f2368651-32aa-4d50-b872-e234e7e63b77",
"name": "email",
"type": "array",
"value": "={{ $('filter Emailadresses').item.json.content.email }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "396f5658-7aab-4804-ade0-ac5283fe96cb",
"name": "邮箱合并",
"type": "n8n-nodes-base.noOp",
"position": [
368,
832
],
"parameters": {},
"typeVersion": 1
},
{
"id": "2fef49c4-2552-429b-bd97-697fcc111913",
"name": "如果是开发者",
"type": "n8n-nodes-base.if",
"position": [
14160,
592
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "33abf56a-611d-47ff-b1cd-e8d72f93d81b",
"operator": {
"type": "string",
"operation": "notEquals"
},
"leftValue": "={{ $('Microsoft Outlook Trigger').first().json.sender.emailAddress.address }}",
"rightValue": "developer@example.com"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "339a908b-5bb2-4ffe-adbe-6a05b34dc590",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-992,
-16
],
"parameters": {
"width": 800,
"height": 1488,
"content": "# 📄 PDF 转订单自动化,适用于 Magento2 (Adobe Commerce / 开源版)"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "d70bcaf1-fc6c-4542-a4b7-0f6d1e30fd61",
"connections": {
"Code": {
"main": [
[
{
"node": "Extract from File2",
"type": "main",
"index": 0
}
]
]
},
"Wait": {
"main": [
[
{
"node": "Loop over products",
"type": "main",
"index": 0
}
]
]
},
"Limit": {
"main": [
[
{
"node": "If express",
"type": "main",
"index": 0
}
]
]
},
"Merge": {
"main": [
[
{
"node": "If configurable product found",
"type": "main",
"index": 0
}
]
]
},
"Keep 1": {
"main": [
[
{
"node": "No Operation, do nothing1",
"type": "main",
"index": 0
}
]
]
},
"Merge1": {
"main": [
[
{
"node": "If product in cart",
"type": "main",
"index": 0
}
]
]
},
"Switch": {
"main": [
[
{
"node": "Vorgangsnummer",
"type": "main",
"index": 0
}
],
[
{
"node": "remove SCH",
"type": "main",
"index": 0
}
],
[
{
"node": "Products",
"type": "main",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "set OpenAI",
"type": "main",
"index": 0
}
]
]
},
"Products": {
"main": [
[
{
"node": "If PO number not empty",
"type": "main",
"index": 0
}
]
]
},
"set Text": {
"main": [
[
{
"node": "Email combine",
"type": "main",
"index": 0
}
]
]
},
"Aggregate": {
"main": [
[
{
"node": "set Billing Address",
"type": "main",
"index": 0
}
]
]
},
"If express": {
"main": [
[
{
"node": "set Standard Shipping Method",
"type": "main",
"index": 0
}
],
[
{
"node": "set Express Shipping Method",
"type": "main",
"index": 0
}
]
]
},
"remove SCH": {
"main": [
[
{
"node": "Products",
"type": "main",
"index": 0
}
]
]
},
"set Emails": {
"main": [
[
{
"node": "Split Emails",
"type": "main",
"index": 0
}
]
]
},
"set OpenAI": {
"main": [
[
{
"node": "filter Emailadresses",
"type": "main",
"index": 0
}
]
]
},
"Create cart": {
"main": [
[
{
"node": "set Quote Id",
"type": "main",
"index": 0
}
]
]
},
"If Customer": {
"main": [
[
{
"node": "set Customer",
"type": "main",
"index": 0
}
],
[
{
"node": "Loop until existing customer found",
"type": "main",
"index": 0
}
]
]
},
"place Order": {
"main": [
[
{
"node": "Move a message",
"type": "main",
"index": 0
}
]
]
},
"set Address": {
"main": [
[
{
"node": "If Default Address",
"type": "main",
"index": 0
}
]
]
},
"If developer": {
"main": [
[
{
"node": "place Order",
"type": "main",
"index": 0
}
],
[
{
"node": "get Cart Items1",
"type": "main",
"index": 0
}
]
]
},
"Split Emails": {
"main": [
[
{
"node": "Loop until existing customer found",
"type": "main",
"index": 0
}
]
]
},
"get Customer": {
"main": [
[
{
"node": "If Customer",
"type": "main",
"index": 0
}
]
]
},
"get Products": {
"main": [
[
{
"node": "Split Out Products",
"type": "main",
"index": 0
}
]
]
},
"set Customer": {
"main": [
[
{
"node": "set Address",
"type": "main",
"index": 0
}
]
]
},
"set Feedback": {
"main": [
[
{
"node": "No Operation, do nothing1",
"type": "main",
"index": 0
}
]
]
},
"set Quote Id": {
"main": [
[
{
"node": "get Cart Items",
"type": "main",
"index": 0
},
{
"node": "get Products",
"type": "main",
"index": 0
}
]
]
},
"Email combine": {
"main": [
[
{
"node": "Code",
"type": "main",
"index": 0
}
]
]
},
"Vorgangsnummer": {
"main": [
[
{
"node": "Products",
"type": "main",
"index": 0
}
]
]
},
"get Cart Items": {
"main": [
[
{
"node": "remove From Shopping Cart",
"type": "main",
"index": 0
}
]
]
},
"get Cart Items1": {
"main": [
[
{
"node": "remove From Shopping Cart1",
"type": "main",
"index": 0
}
]
]
},
"set Information": {
"main": [
[
{
"node": "No Operation, do nothing",
"type": "main",
"index": 0
}
]
]
},
"Combine feedback": {
"main": [
[
{
"node": "Keep 1",
"type": "main",
"index": 0
}
]
]
},
"Emails not empty": {
"main": [
[
{
"node": "Products not empty",
"type": "main",
"index": 0
}
],
[
{
"node": "Set empty email message",
"type": "main",
"index": 0
}
]
]
},
"Execute Workflow": {
"main": [
[
{
"node": "Wait",
"type": "main",
"index": 0
}
]
]
},
"If companyCredit": {
"main": [
[
{
"node": "If developer",
"type": "main",
"index": 0
}
],
[
{
"node": "Pay on account error message",
"type": "main",
"index": 0
}
]
]
},
"get Configurable": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"Extract from File": {
"main": [
[
{
"node": "set Information 2",
"type": "main",
"index": 0
}
]
]
},
"set Information 2": {
"main": [
[
{
"node": "No Operation, do nothing",
"type": "main",
"index": 0
}
]
]
},
"set Order Comment": {
"main": [
[
{
"node": "get Payment Methods",
"type": "main",
"index": 0
}
]
]
},
"Extract from File1": {
"main": [
[
{
"node": "set Information 2",
"type": "main",
"index": 0
}
]
]
},
"Extract from File2": {
"main": [
[
{
"node": "set Information",
"type": "main",
"index": 0
}
]
]
},
"If Default Address": {
"main": [
[
{
"node": "Create cart",
"type": "main",
"index": 0
}
],
[
{
"node": "set Feedback Default Address",
"type": "main",
"index": 0
}
]
]
},
"If product in cart": {
"main": [
[
{
"node": "Combine processed skus",
"type": "main",
"index": 0
},
{
"node": "Aggregate",
"type": "main",
"index": 0
}
],
[
{
"node": "Combine failed skus",
"type": "main",
"index": 0
}
]
]
},
"Json error message": {
"main": [
[
{
"node": "Stop and Error1",
"type": "main",
"index": 0
}
]
]
},
"Loop over products": {
"main": [
[
{
"node": "Merge1",
"type": "main",
"index": 1
}
],
[
{
"node": "Execute Workflow",
"type": "main",
"index": 0
}
]
]
},
"On form submission": {
"main": [
[
{
"node": "Extract from File",
"type": "main",
"index": 0
}
]
]
},
"Products not empty": {
"main": [
[
{
"node": "Switch",
"type": "main",
"index": 0
}
],
[
{
"node": "Set empty products message",
"type": "main",
"index": 0
}
]
]
},
"Split Out Products": {
"main": [
[
{
"node": "set Clean Articlenumber",
"type": "main",
"index": 0
}
]
]
},
"Combine failed skus": {
"main": [
[
{
"node": "set Feedback failed",
"type": "main",
"index": 0
}
]
]
},
"Prepare sku & quote": {
"main": [
[
{
"node": "Loop over products",
"type": "main",
"index": 0
},
{
"node": "Merge1",
"type": "main",
"index": 0
}
]
]
},
"check Companycredit": {
"main": [
[
{
"node": "If companyCredit",
"type": "main",
"index": 0
}
]
]
},
"get Payment Methods": {
"main": [
[
{
"node": "check Companycredit",
"type": "main",
"index": 0
}
]
]
},
"set Billing Address": {
"main": [
[
{
"node": "estimate Shipping Methods",
"type": "main",
"index": 0
}
]
]
},
"set Feedback failed": {
"main": [
[
{
"node": "Combine feedback",
"type": "main",
"index": 0
}
]
]
},
"Combine error fields": {
"main": [
[
{
"node": "Json error message",
"type": "main",
"index": 0
}
]
]
},
"filter Emailadresses": {
"main": [
[
{
"node": "Emails not empty",
"type": "main",
"index": 0
}
]
]
},
"set Reference Number": {
"main": [
[
{
"node": "set Order Comment",
"type": "main",
"index": 0
}
]
]
},
"Combine processed skus": {
"main": [
[
{
"node": "set Feedback processed",
"type": "main",
"index": 0
}
]
]
},
"If PO number not empty": {
"main": [
[
{
"node": "get Order by PO number",
"type": "main",
"index": 0
}
],
[
{
"node": "Set empty PO number message",
"type": "main",
"index": 0
}
]
]
},
"get Order by PO number": {
"main": [
[
{
"node": "IF PO number not exists",
"type": "main",
"index": 0
}
]
]
},
"set Feedback processed": {
"main": [
[
{
"node": "Combine feedback",
"type": "main",
"index": 0
}
]
]
},
"IF PO number not exists": {
"main": [
[
{
"node": "set Emails",
"type": "main",
"index": 0
}
],
[
{
"node": "Set empty PO number message1",
"type": "main",
"index": 0
}
]
]
},
"Set empty email message": {
"main": [
[
{
"node": "No Operation, do nothing3",
"type": "main",
"index": 0
}
]
]
},
"set Clean Articlenumber": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
},
{
"node": "get Configurable",
"type": "main",
"index": 0
}
]
]
},
"Azure OpenAI Chat Model1": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"No Operation, do nothing": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"Microsoft Outlook Trigger": {
"main": [
[
{
"node": "set Text",
"type": "main",
"index": 0
}
]
]
},
"No Operation, do nothing1": {
"main": [
[
{
"node": "Combine error fields",
"type": "main",
"index": 0
}
]
]
},
"No Operation, do nothing2": {
"main": [
[
{
"node": "set Feedback",
"type": "main",
"index": 0
}
]
]
},
"No Operation, do nothing3": {
"main": [
[
{
"node": "Combine error fields",
"type": "main",
"index": 0
}
]
]
},
"No Operation, do nothing4": {
"main": [
[
{
"node": "Combine feedback",
"type": "main",
"index": 0
}
]
]
},
"estimate Shipping Methods": {
"main": [
[
{
"node": "Limit",
"type": "main",
"index": 0
}
]
]
},
"set Feedback configurable": {
"main": [
[
{
"node": "No Operation, do nothing4",
"type": "main",
"index": 0
}
]
]
},
"Set empty products message": {
"main": [
[
{
"node": "No Operation, do nothing3",
"type": "main",
"index": 0
}
]
]
},
"When chat message received": {
"main": [
[
{
"node": "Extract from File1",
"type": "main",
"index": 0
}
]
]
},
"remove From Shopping Cart1": {
"main": [
[
{
"node": "Set successfull message",
"type": "main",
"index": 0
}
]
]
},
"Set empty PO number message": {
"main": [
[
{
"node": "No Operation, do nothing3",
"type": "main",
"index": 0
}
]
]
},
"set Express Shipping Method": {
"main": [
[
{
"node": "set Reference Number",
"type": "main",
"index": 0
}
]
]
},
"Pay on account error message": {
"main": [
[
{
"node": "Combine error fields",
"type": "main",
"index": 0
}
]
]
},
"Set empty PO number message1": {
"main": [
[
{
"node": "No Operation, do nothing3",
"type": "main",
"index": 0
}
]
]
},
"set Feedback Default Address": {
"main": [
[
{
"node": "No Operation, do nothing1",
"type": "main",
"index": 0
}
]
]
},
"set Standard Shipping Method": {
"main": [
[
{
"node": "set Reference Number",
"type": "main",
"index": 0
}
]
]
},
"If configurable product found": {
"main": [
[
{
"node": "Prepare sku & quote",
"type": "main",
"index": 0
}
],
[
{
"node": "set Feedback configurable",
"type": "main",
"index": 0
}
]
]
},
"Loop until existing customer found": {
"main": [
[
{
"node": "No Operation, do nothing2",
"type": "main",
"index": 0
}
],
[
{
"node": "get Customer",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 文档提取, 杂项, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
在可视化参考库中探索n8n节点
在可视化参考库中探索n8n节点
If
Ftp
Set
+93
113 节点I versus AI
其他
WordPress博客自动化专业版(深度研究)v2.1市场
使用GPT-4o、Perplexity AI和多语言支持自动化SEO优化的博客创建
If
Set
Xml
+27
125 节点Daniel Ng
内容创作
每日 WhatsApp 群组智能分析:GPT-4.1 分析与语音消息转录
每日 WhatsApp 群组智能分析:GPT-4.1 分析与语音消息转录
If
Set
Code
+20
52 节点Daniel Lianes
杂项
上下文混合RAG AI文案
Google Drive到Supabase上下文向量数据库同步用于RAG应用
If
Set
Code
+25
76 节点Michael Taleb
AI RAG 检索增强
(Duc)深度研究市场模板
集成PerplexityAI研究和OpenAI内容的多层级WordPress博客生成器
If
Set
Xml
+28
132 节点Daniel Ng
人工智能
灵活新闻聚合器 - 多源集成、AI分析和可设置频道
多源新闻策展系统,集成Mistral AI分析、摘要和自定义频道
If
Set
Xml
+32
120 节点Hybroht
内容创作