8
n8n 中文网amn8n.com

海关税号研究 V2

中级

这是一个Document Extraction, Multimodal AI领域的自动化工作流,包含 14 个节点。主要使用 Set, Gmail, Aggregate, HttpRequest, GoogleSheets 等节点。 通过Google Sheets和海关API自动化HS编码查询与丰富

前置要求
  • Google 账号和 Gmail API 凭证
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "LdR1WNr3yM5Lw9X8",
  "meta": {
    "instanceId": "509eaff0b96002e800c9adf0e9388b12a38c09e15983331392a1f621addc4db4"
  },
  "name": "海关税号研究 V2",
  "tags": [],
  "nodes": [
    {
      "id": "ec7c3dd9-74ee-4008-b32c-da57d6069e30",
      "name": "聊天触发器",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -336,
        336
      ],
      "webhookId": "170756e8-3be9-43f5-81ce-284e8cf78635",
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "0f817acd-9c17-4756-90ba-ff1106edad53",
      "name": "海关税号 API 查询",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -144,
        336
      ],
      "parameters": {
        "url": "=https://www.zolltarifnummern.de/api/v2/cnSuggest?term={{ encodeURIComponent($json.chatInput) }}&lang=de",
        "options": {
          "timeout": 10000,
          "response": {
            "response": {
              "responseFormat": "json"
            }
          },
          "allowUnauthorizedCerts": true
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/json"
            },
            {
              "name": "User-Agent",
              "value": "n8n-workflow/1.0"
            }
          ]
        }
      },
      "typeVersion": 4.2,
      "continueOnFail": true
    },
    {
      "id": "8d670dda-9b23-4542-bb8f-ce7074beac64",
      "name": "输出海关税号",
      "type": "n8n-nodes-base.set",
      "position": [
        48,
        336
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "assignment-1",
              "name": "text",
              "type": "string",
              "value": "={{ $json.suggestions[1].code }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "9b92a873-ecb8-43cc-929f-9514bed35c5e",
      "name": "读取商品描述",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        128,
        560
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1nJ_VAeCwOnFwF-t7rFlbftbkAuT35gig9d7YCGsurHs/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1nJ_VAeCwOnFwF-t7rFlbftbkAuT35gig9d7YCGsurHs",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1nJ_VAeCwOnFwF-t7rFlbftbkAuT35gig9d7YCGsurHs/edit?usp=drivesdk",
          "cachedResultName": "Customs Numbers"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "axR2eMzXvoqKjDp2",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "f95221b2-9d6d-4dd2-bd22-7faab04341f9",
      "name": "遍历项目",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        384,
        560
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "60ddfdb2-b326-4cae-bc20-10cf2631a6ae",
      "name": "将海关税号写入表格",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        992,
        576
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "Artikelbeschreibung",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Artikelbeschreibung",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Zolltarifnummer",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Zolltarifnummer",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [
            "Artikelbeschreibung"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1nJ_VAeCwOnFwF-t7rFlbftbkAuT35gig9d7YCGsurHs/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1nJ_VAeCwOnFwF-t7rFlbftbkAuT35gig9d7YCGsurHs",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1nJ_VAeCwOnFwF-t7rFlbftbkAuT35gig9d7YCGsurHs/edit?usp=drivesdk",
          "cachedResultName": "Customs Numbers"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "axR2eMzXvoqKjDp2",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "9b5f275d-136a-4227-9a62-120bc32e0c0e",
      "name": "海关税号 API 批量查询",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        592,
        576
      ],
      "parameters": {
        "url": "=https://www.zolltarifnummern.de/api/v2/cnSuggest?term={{ encodeURIComponent($json['Artikelbeschreibung']) }}&lang=de",
        "options": {
          "timeout": 10000,
          "response": {
            "response": {
              "responseFormat": "json"
            }
          },
          "allowUnauthorizedCerts": true
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/json"
            },
            {
              "name": "User-Agent",
              "value": "n8n-workflow/1.0"
            }
          ]
        }
      },
      "typeVersion": 4.2,
      "continueOnFail": true
    },
    {
      "id": "653ef025-1c47-4115-94f3-867138e1f654",
      "name": "发送完成邮件",
      "type": "n8n-nodes-base.gmail",
      "position": [
        784,
        352
      ],
      "webhookId": "efe6ce0f-0470-4be7-9056-af5752cf2798",
      "parameters": {
        "sendTo": "test@example.com",
        "message": "Job completed successfully",
        "options": {},
        "subject": "Completed: Customs Tariff Number Research Finished"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "a26hQ5L1HIRZTOqY",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "b02dc4a3-b4e0-4bb1-9d8a-112ac0301b87",
      "name": "聚合",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        560,
        352
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "bb6f42bd-de6e-4adb-97d2-b89867709d5c",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -384,
        256
      ],
      "parameters": {
        "color": 6,
        "width": 640,
        "height": 256,
        "content": "## 手动单次查询海关税号"
      },
      "typeVersion": 1
    },
    {
      "id": "6229ef15-b823-48f2-82bb-f81d07f7f976",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -384,
        528
      ],
      "parameters": {
        "width": 1552,
        "height": 256,
        "content": "## 从列表批量查询"
      },
      "typeVersion": 1
    },
    {
      "id": "7c9e9844-9995-41d6-9ec2-db4a3af10160",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        272,
        256
      ],
      "parameters": {
        "color": 4,
        "width": 896,
        "height": 256,
        "content": "## 完成"
      },
      "typeVersion": 1
    },
    {
      "id": "18289af3-a07a-46ef-abed-10d4bc6aec29",
      "name": "开始查询",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -48,
        560
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "31ef430b-a463-4742-bf36-57509464a684",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -816,
        256
      ],
      "parameters": {
        "color": 3,
        "width": 416,
        "height": 256,
        "content": "### [视频教程](https://youtu.be/UccIqmMmq7w)"
      },
      "typeVersion": 1
    },
    {
      "id": "18d3e9ef-6168-482f-bcd7-d05ae1789975",
      "name": "准备数据",
      "type": "n8n-nodes-base.set",
      "position": [
        800,
        576
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "assignment-1",
              "name": "Zolltarifnummer",
              "type": "string",
              "value": "={{ $json.suggestions && $json.suggestions[1] ? $json.suggestions[1].code : 'Nicht gefunden' }}"
            },
            {
              "id": "assignment-3",
              "name": "Artikelbeschreibung",
              "type": "string",
              "value": "={{ $('Loop Over Items').item.json['Artikelbeschreibung'] }}"
            },
            {
              "id": "bb2fbbce-b66b-42b6-a639-baa949b763e8",
              "name": "Beschreibung der Zolltarifnummer",
              "type": "string",
              "value": "={{ $json.suggestions[1].value.split(/<br\\s*\\/?>/i)[1].trim() }}"
            },
            {
              "id": "f4389d75-a1f3-4ccd-9a62-0f7544923e02",
              "name": "Score",
              "type": "string",
              "value": "={{ ($json.suggestions[1].score * 100).toFixed(1) + '%' }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "7e35bde7-5057-41a1-a1a9-e332db984cff",
  "connections": {
    "Aggregate": {
      "main": [
        [
          {
            "node": "Send Completion Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Start Query": {
      "main": [
        [
          {
            "node": "Read Item Descriptions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Chat Trigger": {
      "main": [
        [
          {
            "node": "Customs Tariff API Query",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "prepare data": {
      "main": [
        [
          {
            "node": "Write Customs Tariff to Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Customs Tariff API Query Batch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Item Descriptions": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Customs Tariff API Query": {
      "main": [
        [
          {
            "node": "Output Customs Tariff Number",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Write Customs Tariff to Sheet": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Customs Tariff API Query Batch": {
      "main": [
        [
          {
            "node": "prepare data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 文档提取, 多模态 AI

需要付费吗?

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

工作流信息
难度等级
中级
节点数量14
分类2
节点类型9
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

外部链接
在 n8n.io 查看

分享此工作流