8
n8n 中文网amn8n.com

比较器

中级

这是一个Building Blocks领域的自动化工作流,包含 7 个节点。主要使用 Set, Code, Switch, ExecuteWorkflowTrigger 等节点。 使用自定义键比较列表,识别共同项和差异项

前置要求
  • 无特殊前置要求,导入即可使用
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "6oFu27D3MfMM86Oz",
  "meta": {
    "instanceId": "b502e5a8bc6c091b48560caa78bb54b47e56d5b7f2538880db0015950174c8b7"
  },
  "name": "比较器",
  "tags": [],
  "nodes": [
    {
      "id": "e13aefae-e377-4ebd-acd9-fb70aaefecfe",
      "name": "当被其他工作流执行时",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        0,
        20
      ],
      "parameters": {
        "workflowInputs": {
          "values": [
            {
              "name": "input_a",
              "type": "array"
            },
            {
              "name": "input_b",
              "type": "array"
            },
            {
              "name": "key"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "85588542-5fcb-415f-b189-bbb38f889bb5",
      "name": "代码",
      "type": "n8n-nodes-base.code",
      "position": [
        440,
        320
      ],
      "parameters": {
        "jsCode": "const listA =$input.first().json.input_a ; \nconst listB = $input.first().json.input_b;\nconst  key = $input.first().json.key;\n\nconst aMap = new Map(listA.map(item => [item[key], item]));\nconst bMap = new Map(listB.map(item => [item[key], item]));\n\nconst common = [];\nconst onlyInA = [];\nconst onlyInB = [];\n\nfor (const [k, itemA] of aMap) {\n  if (bMap.has(k)) {\n    common.push(itemA); // ← keep A's version only\n  } else {\n    onlyInA.push(itemA);\n  }\n}\n\nfor (const [k, itemB] of bMap) {\n  if (!aMap.has(k)) {\n    onlyInB.push(itemB);\n  }\n}\n\nreturn [\n  {\n    json: {\n      common: common,\n      onlyInA: onlyInA,\n      onlyInB: onlyInB\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "f1bee89d-54b2-4cf7-87f6-45e2f940b763",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -140,
        -160
      ],
      "parameters": {
        "content": "## 传入两个要比较的项目列表以及键"
      },
      "typeVersion": 1
    },
    {
      "id": "f04f1c66-e219-46a1-99ff-9e3df7f8d2fa",
      "name": "Google Calendar MCP",
      "type": "n8n-nodes-base.switch",
      "position": [
        220,
        -1
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "673a0546-03d9-44d2-95ea-aecafb41a7d9",
                    "operator": {
                      "type": "string",
                      "operation": "empty",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.key }}",
                    "rightValue": ""
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "e95886e4-4664-40de-b177-1a4d17aa88d8",
                    "operator": {
                      "type": "array",
                      "operation": "empty",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.input_a }}",
                    "rightValue": ""
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "694a102f-2421-48df-9a17-a9270da0b9aa",
                    "operator": {
                      "type": "array",
                      "operation": "empty",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.input_b }}",
                    "rightValue": ""
                  }
                ]
              }
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra"
        }
      },
      "typeVersion": 3.2,
      "alwaysOutputData": true
    },
    {
      "id": "4554a775-e6d4-4ae0-85ff-9564866d1464",
      "name": "验证消息 1",
      "type": "n8n-nodes-base.set",
      "position": [
        440,
        -280
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "39e1492c-820e-4157-963e-cfa5c7d5d0a6",
              "name": "validation_message",
              "type": "string",
              "value": "You must specify a key"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "0fa56f6d-3a28-4382-9916-ddaeb31e0310",
      "name": "验证消息 2",
      "type": "n8n-nodes-base.set",
      "position": [
        440,
        -80
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "ca870eac-56f8-4c5f-9938-1bc53bce7f26",
              "name": "validation_message",
              "type": "string",
              "value": "You must specify input_a"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "2c4b3b98-7a20-418c-af4e-4c2967532e31",
      "name": "验证消息 3",
      "type": "n8n-nodes-base.set",
      "position": [
        440,
        120
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "ca870eac-56f8-4c5f-9938-1bc53bce7f26",
              "name": "validation_message",
              "type": "string",
              "value": "You must specify input_b"
            }
          ]
        }
      },
      "typeVersion": 3.4
    }
  ],
  "active": false,
  "pinData": {
    "When Executed by Another Workflow": [
      {
        "json": {
          "key": "transaction_id",
          "input_a": [
            {
              "amount": 11840,
              "status": "failed",
              "customer": "user1001@example.com",
              "timestamp": "2025-05-02T00:41:00Z",
              "transaction_id": "TX1001"
            },
            {
              "amount": 6174,
              "status": "success",
              "customer": "user1002@example.com",
              "timestamp": "2025-05-02T00:42:00Z",
              "transaction_id": "TX1002"
            },
            {
              "amount": 16462,
              "status": "failed",
              "customer": "user1003@example.com",
              "timestamp": "2025-05-02T00:43:00Z",
              "transaction_id": "TX1003"
            },
            {
              "amount": 8306,
              "status": "success",
              "customer": "user1004@example.com",
              "timestamp": "2025-05-02T00:44:00Z",
              "transaction_id": "TX1004"
            },
            {
              "amount": 17061,
              "status": "failed",
              "customer": "user1005@example.com",
              "timestamp": "2025-05-02T00:45:00Z",
              "transaction_id": "TX1005"
            },
            {
              "amount": 13948,
              "status": "failed",
              "customer": "user1006@example.com",
              "timestamp": "2025-05-02T00:46:00Z",
              "transaction_id": "TX1006"
            },
            {
              "amount": 16560,
              "status": "pending",
              "customer": "user1007@example.com",
              "timestamp": "2025-05-02T00:47:00Z",
              "transaction_id": "TX1007"
            },
            {
              "amount": 10979,
              "status": "success",
              "customer": "user1008@example.com",
              "timestamp": "2025-05-02T00:48:00Z",
              "transaction_id": "TX1008"
            },
            {
              "amount": 17136,
              "status": "pending",
              "customer": "user1009@example.com",
              "timestamp": "2025-05-02T00:49:00Z",
              "transaction_id": "TX1009"
            },
            {
              "amount": 12834,
              "status": "success",
              "customer": "user1010@example.com",
              "timestamp": "2025-05-02T00:50:00Z",
              "transaction_id": "TX1010"
            },
            {
              "amount": 7903,
              "status": "failed",
              "customer": "user1011@example.com",
              "timestamp": "2025-05-02T00:51:00Z",
              "transaction_id": "TX1011"
            },
            {
              "amount": 19348,
              "status": "pending",
              "customer": "user1012@example.com",
              "timestamp": "2025-05-02T00:52:00Z",
              "transaction_id": "TX1012"
            },
            {
              "amount": 18943,
              "status": "failed",
              "customer": "user1013@example.com",
              "timestamp": "2025-05-02T00:53:00Z",
              "transaction_id": "TX1013"
            },
            {
              "amount": 16094,
              "status": "failed",
              "customer": "user1014@example.com",
              "timestamp": "2025-05-02T00:54:00Z",
              "transaction_id": "TX1014"
            },
            {
              "amount": 5181,
              "status": "failed",
              "customer": "user1015@example.com",
              "timestamp": "2025-05-02T00:55:00Z",
              "transaction_id": "TX1015"
            },
            {
              "amount": 16048,
              "status": "failed",
              "customer": "user1016@example.com",
              "timestamp": "2025-05-02T00:56:00Z",
              "transaction_id": "TX1016"
            },
            {
              "amount": 6426,
              "status": "success",
              "customer": "user1017@example.com",
              "timestamp": "2025-05-02T00:57:00Z",
              "transaction_id": "TX1017"
            },
            {
              "amount": 15538,
              "status": "pending",
              "customer": "user1018@example.com",
              "timestamp": "2025-05-02T00:58:00Z",
              "transaction_id": "TX1018"
            },
            {
              "amount": 17804,
              "status": "failed",
              "customer": "user1019@example.com",
              "timestamp": "2025-05-02T00:59:00Z",
              "transaction_id": "TX1019"
            },
            {
              "amount": 14445,
              "status": "pending",
              "customer": "user1020@example.com",
              "timestamp": "2025-05-02T01:00:00Z",
              "transaction_id": "TX1020"
            },
            {
              "amount": 15229,
              "status": "pending",
              "customer": "user1021@example.com",
              "timestamp": "2025-05-02T01:01:00Z",
              "transaction_id": "TX1021"
            },
            {
              "amount": 6153,
              "status": "failed",
              "customer": "user1022@example.com",
              "timestamp": "2025-05-02T01:02:00Z",
              "transaction_id": "TX1022"
            },
            {
              "amount": 19890,
              "status": "success",
              "customer": "user1023@example.com",
              "timestamp": "2025-05-02T01:03:00Z",
              "transaction_id": "TX1023"
            },
            {
              "amount": 16230,
              "status": "failed",
              "customer": "user1024@example.com",
              "timestamp": "2025-05-02T01:04:00Z",
              "transaction_id": "TX1024"
            },
            {
              "amount": 18620,
              "status": "success",
              "customer": "user1025@example.com",
              "timestamp": "2025-05-02T01:05:00Z",
              "transaction_id": "TX1025"
            },
            {
              "amount": 17504,
              "status": "success",
              "customer": "user1026@example.com",
              "timestamp": "2025-05-02T01:06:00Z",
              "transaction_id": "TX1026"
            },
            {
              "amount": 14816,
              "status": "pending",
              "customer": "user1027@example.com",
              "timestamp": "2025-05-02T01:07:00Z",
              "transaction_id": "TX1027"
            },
            {
              "amount": 18519,
              "status": "success",
              "customer": "user1028@example.com",
              "timestamp": "2025-05-02T01:08:00Z",
              "transaction_id": "TX1028"
            },
            {
              "amount": 10161,
              "status": "pending",
              "customer": "user1029@example.com",
              "timestamp": "2025-05-02T01:09:00Z",
              "transaction_id": "TX1029"
            },
            {
              "amount": 16523,
              "status": "pending",
              "customer": "user1030@example.com",
              "timestamp": "2025-05-02T01:10:00Z",
              "transaction_id": "TX1030"
            },
            {
              "amount": 13537,
              "status": "failed",
              "customer": "user1031@example.com",
              "timestamp": "2025-05-02T01:11:00Z",
              "transaction_id": "TX1031"
            },
            {
              "amount": 13942,
              "status": "pending",
              "customer": "user1032@example.com",
              "timestamp": "2025-05-02T01:12:00Z",
              "transaction_id": "TX1032"
            },
            {
              "amount": 5970,
              "status": "success",
              "customer": "user1033@example.com",
              "timestamp": "2025-05-02T01:13:00Z",
              "transaction_id": "TX1033"
            },
            {
              "amount": 13842,
              "status": "failed",
              "customer": "user1034@example.com",
              "timestamp": "2025-05-02T01:14:00Z",
              "transaction_id": "TX1034"
            },
            {
              "amount": 5139,
              "status": "pending",
              "customer": "user1035@example.com",
              "timestamp": "2025-05-02T01:15:00Z",
              "transaction_id": "TX1035"
            },
            {
              "amount": 7040,
              "status": "pending",
              "customer": "user1036@example.com",
              "timestamp": "2025-05-02T01:16:00Z",
              "transaction_id": "TX1036"
            },
            {
              "amount": 6604,
              "status": "pending",
              "customer": "user1037@example.com",
              "timestamp": "2025-05-02T01:17:00Z",
              "transaction_id": "TX1037"
            },
            {
              "amount": 15016,
              "status": "failed",
              "customer": "user1038@example.com",
              "timestamp": "2025-05-02T01:18:00Z",
              "transaction_id": "TX1038"
            },
            {
              "amount": 8183,
              "status": "pending",
              "customer": "user1039@example.com",
              "timestamp": "2025-05-02T01:19:00Z",
              "transaction_id": "TX1039"
            },
            {
              "amount": 7528,
              "status": "pending",
              "customer": "user1040@example.com",
              "timestamp": "2025-05-02T01:20:00Z",
              "transaction_id": "TX1040"
            },
            {
              "amount": 7317,
              "status": "failed",
              "customer": "user1041@example.com",
              "timestamp": "2025-05-02T01:21:00Z",
              "transaction_id": "TX1041"
            },
            {
              "amount": 11452,
              "status": "failed",
              "customer": "user1042@example.com",
              "timestamp": "2025-05-02T01:22:00Z",
              "transaction_id": "TX1042"
            },
            {
              "amount": 9342,
              "status": "failed",
              "customer": "user1043@example.com",
              "timestamp": "2025-05-02T01:23:00Z",
              "transaction_id": "TX1043"
            },
            {
              "amount": 9512,
              "status": "pending",
              "customer": "user1044@example.com",
              "timestamp": "2025-05-02T01:24:00Z",
              "transaction_id": "TX1044"
            },
            {
              "amount": 14267,
              "status": "success",
              "customer": "user1045@example.com",
              "timestamp": "2025-05-02T01:25:00Z",
              "transaction_id": "TX1045"
            },
            {
              "amount": 10563,
              "status": "success",
              "customer": "user1046@example.com",
              "timestamp": "2025-05-02T01:26:00Z",
              "transaction_id": "TX1046"
            },
            {
              "amount": 9781,
              "status": "pending",
              "customer": "user1047@example.com",
              "timestamp": "2025-05-02T01:27:00Z",
              "transaction_id": "TX1047"
            },
            {
              "amount": 9480,
              "status": "pending",
              "customer": "user1048@example.com",
              "timestamp": "2025-05-02T01:28:00Z",
              "transaction_id": "TX1048"
            },
            {
              "amount": 16356,
              "status": "success",
              "customer": "user1049@example.com",
              "timestamp": "2025-05-02T01:29:00Z",
              "transaction_id": "TX1049"
            },
            {
              "amount": 12390,
              "status": "pending",
              "customer": "user1050@example.com",
              "timestamp": "2025-05-02T01:30:00Z",
              "transaction_id": "TX1050"
            }
          ],
          "input_b": [
            {
              "amount": 19248,
              "status": "success",
              "customer": "user1026b@example.com",
              "timestamp": "2025-05-02T01:06:00Z",
              "transaction_id": "TX1026"
            },
            {
              "amount": 18199,
              "status": "success",
              "customer": "user1027b@example.com",
              "timestamp": "2025-05-02T01:07:00Z",
              "transaction_id": "TX1027"
            },
            {
              "amount": 6436,
              "status": "success",
              "customer": "user1028b@example.com",
              "timestamp": "2025-05-02T01:08:00Z",
              "transaction_id": "TX1028"
            },
            {
              "amount": 14595,
              "status": "failed",
              "customer": "user1029b@example.com",
              "timestamp": "2025-05-02T01:09:00Z",
              "transaction_id": "TX1029"
            },
            {
              "amount": 12791,
              "status": "pending",
              "customer": "user1030b@example.com",
              "timestamp": "2025-05-02T01:10:00Z",
              "transaction_id": "TX1030"
            },
            {
              "amount": 5304,
              "status": "success",
              "customer": "user1031b@example.com",
              "timestamp": "2025-05-02T01:11:00Z",
              "transaction_id": "TX1031"
            },
            {
              "amount": 16836,
              "status": "failed",
              "customer": "user1032b@example.com",
              "timestamp": "2025-05-02T01:12:00Z",
              "transaction_id": "TX1032"
            },
            {
              "amount": 13749,
              "status": "pending",
              "customer": "user1033b@example.com",
              "timestamp": "2025-05-02T01:13:00Z",
              "transaction_id": "TX1033"
            },
            {
              "amount": 8821,
              "status": "success",
              "customer": "user1034b@example.com",
              "timestamp": "2025-05-02T01:14:00Z",
              "transaction_id": "TX1034"
            },
            {
              "amount": 17962,
              "status": "pending",
              "customer": "user1035b@example.com",
              "timestamp": "2025-05-02T01:15:00Z",
              "transaction_id": "TX1035"
            },
            {
              "amount": 11613,
              "status": "pending",
              "customer": "user1036b@example.com",
              "timestamp": "2025-05-02T01:16:00Z",
              "transaction_id": "TX1036"
            },
            {
              "amount": 18324,
              "status": "failed",
              "customer": "user1037b@example.com",
              "timestamp": "2025-05-02T01:17:00Z",
              "transaction_id": "TX1037"
            },
            {
              "amount": 5642,
              "status": "failed",
              "customer": "user1038b@example.com",
              "timestamp": "2025-05-02T01:18:00Z",
              "transaction_id": "TX1038"
            },
            {
              "amount": 13180,
              "status": "failed",
              "customer": "user1039b@example.com",
              "timestamp": "2025-05-02T01:19:00Z",
              "transaction_id": "TX1039"
            },
            {
              "amount": 5071,
              "status": "failed",
              "customer": "user1040b@example.com",
              "timestamp": "2025-05-02T01:20:00Z",
              "transaction_id": "TX1040"
            },
            {
              "amount": 10293,
              "status": "failed",
              "customer": "user1041b@example.com",
              "timestamp": "2025-05-02T01:21:00Z",
              "transaction_id": "TX1041"
            },
            {
              "amount": 18056,
              "status": "pending",
              "customer": "user1042b@example.com",
              "timestamp": "2025-05-02T01:22:00Z",
              "transaction_id": "TX1042"
            },
            {
              "amount": 6462,
              "status": "success",
              "customer": "user1043b@example.com",
              "timestamp": "2025-05-02T01:23:00Z",
              "transaction_id": "TX1043"
            },
            {
              "amount": 12051,
              "status": "failed",
              "customer": "user1044b@example.com",
              "timestamp": "2025-05-02T01:24:00Z",
              "transaction_id": "TX1044"
            },
            {
              "amount": 6234,
              "status": "failed",
              "customer": "user1045b@example.com",
              "timestamp": "2025-05-02T01:25:00Z",
              "transaction_id": "TX1045"
            },
            {
              "amount": 9612,
              "status": "failed",
              "customer": "user1046b@example.com",
              "timestamp": "2025-05-02T01:26:00Z",
              "transaction_id": "TX1046"
            },
            {
              "amount": 18897,
              "status": "success",
              "customer": "user1047b@example.com",
              "timestamp": "2025-05-02T01:27:00Z",
              "transaction_id": "TX1047"
            },
            {
              "amount": 9226,
              "status": "success",
              "customer": "user1048b@example.com",
              "timestamp": "2025-05-02T01:28:00Z",
              "transaction_id": "TX1048"
            },
            {
              "amount": 7580,
              "status": "failed",
              "customer": "user1049b@example.com",
              "timestamp": "2025-05-02T01:29:00Z",
              "transaction_id": "TX1049"
            },
            {
              "amount": 5471,
              "status": "pending",
              "customer": "user1050b@example.com",
              "timestamp": "2025-05-02T01:30:00Z",
              "transaction_id": "TX1050"
            },
            {
              "amount": 10350,
              "status": "failed",
              "customer": "user1051@example.com",
              "timestamp": "2025-05-02T01:31:00Z",
              "transaction_id": "TX1051"
            },
            {
              "amount": 18185,
              "status": "pending",
              "customer": "user1052@example.com",
              "timestamp": "2025-05-02T01:32:00Z",
              "transaction_id": "TX1052"
            },
            {
              "amount": 16701,
              "status": "pending",
              "customer": "user1053@example.com",
              "timestamp": "2025-05-02T01:33:00Z",
              "transaction_id": "TX1053"
            },
            {
              "amount": 7212,
              "status": "success",
              "customer": "user1054@example.com",
              "timestamp": "2025-05-02T01:34:00Z",
              "transaction_id": "TX1054"
            },
            {
              "amount": 13990,
              "status": "pending",
              "customer": "user1055@example.com",
              "timestamp": "2025-05-02T01:35:00Z",
              "transaction_id": "TX1055"
            },
            {
              "amount": 12908,
              "status": "failed",
              "customer": "user1056@example.com",
              "timestamp": "2025-05-02T01:36:00Z",
              "transaction_id": "TX1056"
            },
            {
              "amount": 8428,
              "status": "failed",
              "customer": "user1057@example.com",
              "timestamp": "2025-05-02T01:37:00Z",
              "transaction_id": "TX1057"
            },
            {
              "amount": 10953,
              "status": "pending",
              "customer": "user1058@example.com",
              "timestamp": "2025-05-02T01:38:00Z",
              "transaction_id": "TX1058"
            },
            {
              "amount": 13393,
              "status": "pending",
              "customer": "user1059@example.com",
              "timestamp": "2025-05-02T01:39:00Z",
              "transaction_id": "TX1059"
            },
            {
              "amount": 7002,
              "status": "success",
              "customer": "user1060@example.com",
              "timestamp": "2025-05-02T01:40:00Z",
              "transaction_id": "TX1060"
            },
            {
              "amount": 12233,
              "status": "pending",
              "customer": "user1061@example.com",
              "timestamp": "2025-05-02T01:41:00Z",
              "transaction_id": "TX1061"
            },
            {
              "amount": 9122,
              "status": "pending",
              "customer": "user1062@example.com",
              "timestamp": "2025-05-02T01:42:00Z",
              "transaction_id": "TX1062"
            },
            {
              "amount": 12199,
              "status": "pending",
              "customer": "user1063@example.com",
              "timestamp": "2025-05-02T01:43:00Z",
              "transaction_id": "TX1063"
            },
            {
              "amount": 12622,
              "status": "success",
              "customer": "user1064@example.com",
              "timestamp": "2025-05-02T01:44:00Z",
              "transaction_id": "TX1064"
            },
            {
              "amount": 19944,
              "status": "failed",
              "customer": "user1065@example.com",
              "timestamp": "2025-05-02T01:45:00Z",
              "transaction_id": "TX1065"
            },
            {
              "amount": 19436,
              "status": "success",
              "customer": "user1066@example.com",
              "timestamp": "2025-05-02T01:46:00Z",
              "transaction_id": "TX1066"
            },
            {
              "amount": 15468,
              "status": "pending",
              "customer": "user1067@example.com",
              "timestamp": "2025-05-02T01:47:00Z",
              "transaction_id": "TX1067"
            },
            {
              "amount": 19027,
              "status": "failed",
              "customer": "user1068@example.com",
              "timestamp": "2025-05-02T01:48:00Z",
              "transaction_id": "TX1068"
            },
            {
              "amount": 15309,
              "status": "success",
              "customer": "user1069@example.com",
              "timestamp": "2025-05-02T01:49:00Z",
              "transaction_id": "TX1069"
            },
            {
              "amount": 10424,
              "status": "pending",
              "customer": "user1070@example.com",
              "timestamp": "2025-05-02T01:50:00Z",
              "transaction_id": "TX1070"
            },
            {
              "amount": 18350,
              "status": "failed",
              "customer": "user1071@example.com",
              "timestamp": "2025-05-02T01:51:00Z",
              "transaction_id": "TX1071"
            },
            {
              "amount": 14119,
              "status": "success",
              "customer": "user1072@example.com",
              "timestamp": "2025-05-02T01:52:00Z",
              "transaction_id": "TX1072"
            },
            {
              "amount": 16004,
              "status": "pending",
              "customer": "user1073@example.com",
              "timestamp": "2025-05-02T01:53:00Z",
              "transaction_id": "TX1073"
            },
            {
              "amount": 17157,
              "status": "pending",
              "customer": "user1074@example.com",
              "timestamp": "2025-05-02T01:54:00Z",
              "transaction_id": "TX1074"
            },
            {
              "amount": 12849,
              "status": "pending",
              "customer": "user1075@example.com",
              "timestamp": "2025-05-02T01:55:00Z",
              "transaction_id": "TX1075"
            }
          ]
        }
      }
    ]
  },
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "29cfe6be-abca-424c-99aa-ad781eb68e98",
  "connections": {
    "Code": {
      "main": [
        []
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "validation_message 1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "validation_message 2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "validation_message 3",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 构建模块

需要付费吗?

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

工作流信息
难度等级
中级
节点数量7
分类1
节点类型5
难度说明

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

作者
Tenkay

Tenkay

@tenkay

I'm a software developer with over 11 years of experience building systems across various stacks. I'm now applying that expertise to create practical and scalable workflow automations with n8n — focusing on clean logic, real-world use cases, and reusability. Always open to learning, sharing, and collaborating.

外部链接
在 n8n.io 查看

分享此工作流