8
n8n 中文网amn8n.com

在不更改WEBHOOK_URL的情况下测试n8n中的Webhooks(PostBin和BambooHR示例)

高级

这是一个HR, Building Blocks领域的自动化工作流,包含 58 个节点。主要使用 Set, Wait, Merge, Slack, Filter 等节点。 在不更改WEBHOOK_URL的情况下测试n8n中的Webhooks(PostBin和BambooHR示例)

前置要求
  • Slack Bot Token 或 Webhook URL
  • 可能需要目标 API 的认证凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "sB6dC0GZ7zZHuMGF",
  "meta": {
    "instanceId": "a9f3b18652ddc96459b459de4fa8fa33252fb820a9e5a1593074f3580352864a",
    "templateCredsSetupCompleted": true
  },
  "name": "在不更改WEBHOOK_URL的情况下测试n8n中的Webhooks(PostBin和BambooHR示例)",
  "tags": [
    {
      "id": "qtD3SYKEoYtiqguT",
      "name": "building_blocks",
      "createdAt": "2025-02-08T21:20:40.051Z",
      "updatedAt": "2025-02-08T21:20:40.051Z"
    },
    {
      "id": "mCgqKYNfNWwqIQG3",
      "name": "ai",
      "createdAt": "2025-02-08T21:20:49.438Z",
      "updatedAt": "2025-02-08T21:20:49.438Z"
    },
    {
      "id": "EjQkfx3v7nH79HWo",
      "name": "hr",
      "createdAt": "2025-02-08T21:20:57.598Z",
      "updatedAt": "2025-02-08T21:20:57.598Z"
    },
    {
      "id": "suSDrJxibUi10zsu",
      "name": "engineering",
      "createdAt": "2025-02-08T21:21:43.564Z",
      "updatedAt": "2025-02-08T21:21:43.564Z"
    }
  ],
  "nodes": [
    {
      "id": "2529ea94-8427-4fbb-bac0-79fec29fe943",
      "name": "点击“测试工作流”时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        440,
        1220
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "067ce1b6-a511-448b-a268-7d0869ed2b36",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        600,
        980
      ],
      "parameters": {
        "color": 6,
        "width": 550.7128407259806,
        "height": 151.03568930452542,
        "content": "### 要求:"
      },
      "typeVersion": 1
    },
    {
      "id": "62a65021-8bc5-4bd3-95e4-b0616c0cbbe6",
      "name": "便签 1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1620,
        1620
      ],
      "parameters": {
        "color": 7,
        "width": 804.2810233962304,
        "height": 154.2786603126325,
        "content": "## BambooHR webhook的其他用例"
      },
      "typeVersion": 1
    },
    {
      "id": "63e5f28a-83ea-44be-ad91-ab2b635551a1",
      "name": "便签 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        800,
        1140
      ],
      "parameters": {
        "color": 7,
        "width": 600.2141303561856,
        "height": 246.1007234368067,
        "content": "## 在PostBin中创建新的Bin(以上步骤#1)"
      },
      "typeVersion": 1
    },
    {
      "id": "1afbac45-116e-4c8b-886c-24a96ba286ab",
      "name": "合并",
      "type": "n8n-nodes-base.merge",
      "position": [
        1680,
        1240
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combineBy": "combineByPosition"
      },
      "typeVersion": 3
    },
    {
      "id": "367315b0-eba5-4768-bdb0-8be23d965f6c",
      "name": "便签 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1840,
        1180
      ],
      "parameters": {
        "color": 7,
        "width": 424.9937286279833,
        "height": 248.92215299422725,
        "content": "## 注册webhook(以上步骤#2)"
      },
      "typeVersion": 1
    },
    {
      "id": "5b860a4e-66c9-4996-bd8f-ac642eca9021",
      "name": "便签 4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1400,
        300
      ],
      "parameters": {
        "color": 4,
        "width": 291.16380512688715,
        "height": 397.605174332017,
        "content": "## 步骤#3:确认webhook功能"
      },
      "typeVersion": 1
    },
    {
      "id": "c6d78f60-0e05-452c-b50d-4bee9b4e1220",
      "name": "便签 5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        600,
        300
      ],
      "parameters": {
        "color": 4,
        "width": 611.7032537942721,
        "height": 397.94343220191183,
        "content": "## 步骤#1:在PostBin中创建新的Bin"
      },
      "typeVersion": 1
    },
    {
      "id": "6bdd564e-daf7-4259-a283-547f8257dcce",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        580,
        140
      ],
      "parameters": {
        "color": 7,
        "width": 1140.1894415469083,
        "height": 593.490746966612,
        "content": "## 如何在不更改WEBHOOK_URL的情况下测试短期Webhook"
      },
      "typeVersion": 1
    },
    {
      "id": "06b12932-bc46-46ff-a316-518cd1e24546",
      "name": "便签 10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1420,
        600
      ],
      "parameters": {
        "color": 2,
        "width": 255.54164387152053,
        "height": 80,
        "content": "**这可能返回404**"
      },
      "typeVersion": 1
    },
    {
      "id": "17eabcf5-9ae7-4e79-bdb5-3664fa286aeb",
      "name": "创建Bin",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        660,
        420
      ],
      "parameters": {
        "url": "https://www.postb.in/api/bin",
        "method": "POST",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "5b233ff1-475a-48a7-a5d2-4ce82adb2213",
      "name": "获取Bin",
      "type": "n8n-nodes-base.postBin",
      "position": [
        860,
        420
      ],
      "parameters": {
        "binId": "={{ $json.binId }}",
        "operation": "get",
        "requestOptions": {}
      },
      "typeVersion": 1
    },
    {
      "id": "14e0b2fc-f1bb-4eae-be81-069641f27b53",
      "name": "便签11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        620,
        600
      ],
      "parameters": {
        "color": 7,
        "width": 182.23771342026427,
        "height": 80,
        "content": "使用API调用绕过n8n中损坏的PostBin创建bin端点。"
      },
      "typeVersion": 1
    },
    {
      "id": "2eb51697-744e-4bfc-ae3e-ad28bcdc21b1",
      "name": "便签 12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        840,
        600
      ],
      "parameters": {
        "color": 7,
        "width": 351.0986223154297,
        "height": 80,
        "content": "检索binId(也可以在创建Bin节点的响应中找到)。构建使用`https://www.postb.in/:binId`结构的URL"
      },
      "typeVersion": 1
    },
    {
      "id": "ae7367be-ca86-4cac-a763-3627a176d988",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        580,
        740
      ],
      "parameters": {
        "width": 631.0482952232512,
        "height": 113.5322633928848,
        "content": "**根据PostBin API文档:**"
      },
      "typeVersion": 1
    },
    {
      "id": "be327737-1e33-4107-9f98-66a6d66d2886",
      "name": "格式化webhook的URL",
      "type": "n8n-nodes-base.set",
      "position": [
        1060,
        420
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "5235b8f1-f284-472f-b6a5-25c16bc4a66e",
              "name": "webhook_url",
              "type": "string",
              "value": "=https://www.postb.in/{{ $json.binId }}"
            },
            {
              "id": "35d56f07-4f6b-422a-8a03-0c3e49f4d734",
              "name": "binId",
              "type": "string",
              "value": "={{ $json.binId }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "463d247c-ac97-4d79-a0c9-8c0785240a73",
      "name": "获取最近的请求",
      "type": "n8n-nodes-base.postBin",
      "position": [
        1500,
        420
      ],
      "parameters": {
        "binId": "={{ $('Format url for webhook').item.json.binId }}",
        "resource": "request",
        "operation": "removeFirst",
        "requestOptions": {}
      },
      "typeVersion": 1
    },
    {
      "id": "ef07fa4e-1411-474e-ba98-171abae9542d",
      "name": "模拟请求",
      "type": "n8n-nodes-base.postBin",
      "position": [
        1260,
        580
      ],
      "parameters": {
        "binId": "={{ $('Format url for webhook').item.json.binId }}",
        "resource": "request",
        "operation": "send",
        "binContent": "=",
        "requestOptions": {}
      },
      "typeVersion": 1
    },
    {
      "id": "6769b161-6dff-4732-b1cd-900b2e64ffc9",
      "name": "便签9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        580,
        900
      ],
      "parameters": {
        "color": 4,
        "width": 4124.530158203355,
        "height": 962.561104644939,
        "content": "## 示例:在BambooHR中注册并测试webhook"
      },
      "typeVersion": 1
    },
    {
      "id": "a7f57c0a-3918-450b-b1a7-edd80e6edcf6",
      "name": "创建Bin1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        860,
        1220
      ],
      "parameters": {
        "url": "https://www.postb.in/api/bin",
        "method": "POST",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "8a9ef96b-eb99-4fe5-aa82-0b4453d90dff",
      "name": "获取Bin1",
      "type": "n8n-nodes-base.postBin",
      "position": [
        1060,
        1220
      ],
      "parameters": {
        "binId": "={{ $json.binId }}",
        "operation": "get",
        "requestOptions": {}
      },
      "typeVersion": 1
    },
    {
      "id": "c70ff70f-80c6-4516-b278-bad82655d78c",
      "name": "格式化webhook1的URL",
      "type": "n8n-nodes-base.set",
      "position": [
        1260,
        1220
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "5235b8f1-f284-472f-b6a5-25c16bc4a66e",
              "name": "url",
              "type": "string",
              "value": "=https://www.postb.in/{{ $json.binId }}"
            },
            {
              "id": "35d56f07-4f6b-422a-8a03-0c3e49f4d734",
              "name": "binId",
              "type": "string",
              "value": "={{ $json.binId }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "793cd3ab-1459-4382-b9f7-5630869a871e",
      "name": "设置BambooHR子域名",
      "type": "n8n-nodes-base.set",
      "position": [
        660,
        1480
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "89c9eb04-196b-4cb0-afec-dab071dcc471",
              "name": "subdomain",
              "type": "string",
              "value": "example"
            }
          ]
        }
      },
      "executeOnce": true,
      "typeVersion": 3.4
    },
    {
      "id": "06703339-8e5b-4267-ae23-15540ea00692",
      "name": "拆分字段",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1060,
        1480
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "fields"
      },
      "typeVersion": 1
    },
    {
      "id": "b8086b64-0e27-4294-a230-3d6f428a2ddb",
      "name": "合并要监控的字段",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1460,
        1480
      ],
      "parameters": {
        "options": {},
        "fieldsToAggregate": {
          "fieldToAggregate": [
            {
              "renameField": true,
              "outputFieldName": "monitorFields",
              "fieldToAggregate": "alias"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "6c75204f-8527-467f-b982-bed268843fde",
      "name": "格式化BambooHR webhook的有效载荷",
      "type": "n8n-nodes-base.set",
      "position": [
        1900,
        1240
      ],
      "parameters": {
        "include": "except",
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "188d1a10-d32c-4e48-8bad-f8a5002c34a9",
              "name": "name",
              "type": "string",
              "value": "Webhook Test"
            },
            {
              "id": "cfcd6de9-c20f-4935-8b5f-548bd6c381bf",
              "name": "format",
              "type": "string",
              "value": "json"
            },
            {
              "id": "c0b22bc7-d873-4973-9e27-6931dde4b8b1",
              "name": "limit.times",
              "type": "number",
              "value": 1
            },
            {
              "id": "5e912e0a-d3fe-46e5-b85a-b22be0ae3eb1",
              "name": "limit.seconds",
              "type": "number",
              "value": 60
            },
            {
              "id": "0a197fcf-4d30-4112-a441-5ee4dbfaa350",
              "name": "postFields",
              "type": "object",
              "value": "={{ {\"employeeNumber\": \"Employee #\",\n        \"firstName\": \"First name\",\n        \"lastName\": \"Last name\",\n        \"jobTitle\": \"Job title\"} }}"
            },
            {
              "id": "aa292476-0ee2-49fc-afce-4788ff37475a",
              "name": "frequency",
              "type": "object",
              "value": "={\n  \"hour\": null,\n  \"minute\": null,\n  \"day\": null,\n  \"month\": null\n}"
            },
            {
              "id": "0e6c44e5-c918-4897-b865-5e1848ff8444",
              "name": "subdomain",
              "type": "string",
              "value": "={{ $('SET BambooHR subdomain').first().json.subdomain }}"
            }
          ]
        },
        "excludeFields": "binId",
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "b0191582-e8d3-4432-b8e8-38ff0fc782fb",
      "name": "在BambooHR中创建webhook",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2100,
        1240
      ],
      "parameters": {
        "url": "=https://api.bamboohr.com/api/gateway.php/{{ $json.subdomain }}/v1/webhooks/",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ $json.removeField(\"subdomain\").toJsonString() }}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBasicAuth"
      },
      "credentials": {
        "httpBasicAuth": {
          "id": "XXXXXX",
          "name": "BambooHR Basic Auth"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "6f8d47f3-1a80-4317-a9eb-89188c70618c",
      "name": "为员工创建虚拟数据",
      "type": "n8n-nodes-base.debugHelper",
      "position": [
        2380,
        1240
      ],
      "parameters": {
        "category": "randomData",
        "randomDataCount": 3
      },
      "typeVersion": 1
    },
    {
      "id": "b3ba2315-f7d7-474b-9f06-3dbad510fb93",
      "name": "便签 13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        800,
        1407.2486467347771
      ],
      "parameters": {
        "color": 7,
        "width": 794.510445997778,
        "height": 368.01097806266364,
        "content": "## 从BambooHR获取要监控更改的字段[[来源]](https://documentation.bamboohr.com/reference/get-monitor-fields)"
      },
      "typeVersion": 1
    },
    {
      "id": "34956bf7-ef81-425b-a348-bffa99f278bd",
      "name": "便签14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2320,
        1180
      ],
      "parameters": {
        "color": 7,
        "width": 416.47592441009544,
        "height": 250.72353860519,
        "content": "## 测试webhook"
      },
      "typeVersion": 1
    },
    {
      "id": "077934b0-21c5-49ef-9482-fa52ecbe917f",
      "name": "仅保留新员工字段",
      "type": "n8n-nodes-base.filter",
      "position": [
        1260,
        1480
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "e1daab1a-bee5-4308-82f9-6660e957722d",
              "operator": {
                "type": "array",
                "operation": "contains",
                "rightType": "any"
              },
              "leftValue": "={{ [\"employmentHistoryStatus\",\"employeeStatusDate\",\"hireDate\",\"originalHireDate\"] }}",
              "rightValue": "={{ $json.alias }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "ecd27c9d-fe7a-45fa-b085-e68535c334af",
      "name": "便签15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        820,
        1653.074026323302
      ],
      "parameters": {
        "width": 568.1578343498747,
        "height": 101.29440680672363,
        "content": "### 关于此部分的说明"
      },
      "typeVersion": 1
    },
    {
      "id": "2b0ee3a5-1b9f-4f8f-b024-2c576573d2d6",
      "name": "获取BambooHR中所有可监控字段",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        860,
        1480
      ],
      "parameters": {
        "url": "=https://api.bamboohr.com/api/gateway.php/{{ $json.subdomain }}/v1/webhooks/monitor_fields",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBasicAuth"
      },
      "credentials": {
        "httpBasicAuth": {
          "id": "XXXXXX",
          "name": "BambooHR Basic Auth"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "97923d51-c895-4215-b808-4ade22ea6011",
      "name": "注册并测试webhook",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1260,
        420
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "4e48efac-eec6-48cc-b940-b04bda667953",
      "name": "便签8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1228.9696450873366,
        300
      ],
      "parameters": {
        "color": 4,
        "width": 157.46160832218783,
        "height": 397.57230173351894,
        "content": "## 步骤#2"
      },
      "typeVersion": 1
    },
    {
      "id": "f7147f00-19d1-4c0f-a75b-a7fd18f16c31",
      "name": "便签 16",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2940,
        1040
      ],
      "parameters": {
        "color": 7,
        "width": 296.68826711085643,
        "height": 497.77627578351644,
        "content": "## 步骤#3:确认webhook功能"
      },
      "typeVersion": 1
    },
    {
      "id": "ea428b8f-fb4c-44bd-bcf0-bb7f40f3ed98",
      "name": "检查BambooHR中对webhook的调用",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        3040,
        1140
      ],
      "parameters": {
        "url": "=https://api.bamboohr.com/api/gateway.php/{{ $('Format payload for BambooHR webhook').item.json.subdomain }}/v1/webhooks/{{ $('Create webhook in BambooHR').item.json.id }}/log",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBasicAuth"
      },
      "credentials": {
        "httpBasicAuth": {
          "id": "XXXXXX",
          "name": "BambooHR Basic Auth"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "2aa4610d-48a8-4c15-be21-1adbb3bb8b1a",
      "name": "使用虚拟数据创建员工记录",
      "type": "n8n-nodes-base.bambooHr",
      "position": [
        2580,
        1240
      ],
      "parameters": {
        "lastName": "={{ $json.lastname }}",
        "firstName": "={{ $json.firstname }}",
        "additionalFields": {
          "hireDate": "={{ $now }}",
          "department": 18264
        }
      },
      "credentials": {
        "bambooHrApi": {
          "id": "XXXXXX",
          "name": "BambooHR account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f912f38c-fb3b-4357-87fe-cca9aea7ebf4",
      "name": "拆分员工",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        3300,
        1340
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "body.employees"
      },
      "typeVersion": 1
    },
    {
      "id": "200f8afe-f872-4598-b376-6e5cd053aa7d",
      "name": "格式化显示名称",
      "type": "n8n-nodes-base.set",
      "position": [
        3500,
        1340
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "41e8a654-af0e-42db-a9f8-23bc951d34a9",
              "name": "displayName",
              "type": "string",
              "value": "={{ $json.fields[\"First name\"].value + \" \" +  $json.fields[\"Last name\"].value}}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "5fdf5f56-42ea-4891-9b66-5d3d290d0862",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        4100,
        1480
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "XXXXXX",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "c3b02b2a-2135-41da-a881-25cf2135ff71",
      "name": "自动修复输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserAutofixing",
      "position": [
        4200,
        1480
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "e32e3977-1a4c-4b74-839e-278621ac59ec",
      "name": "OpenAI 聊天模型1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        4200,
        1640
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "XXXXXX",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "aaf59e1e-4db6-416b-8602-d5dab0959783",
      "name": "结构化输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        4420,
        1640
      ],
      "parameters": {
        "jsonSchemaExample": "{\n\t\"welcome_message\": \"We are excited to welcome employee_name to the company!\"\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "cc6702aa-8e96-40ad-805e-306e94b0be13",
      "name": "基础LLM链",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        4100,
        1340
      ],
      "parameters": {
        "text": "=Write a message to be shared with other employees welcoming our new {{ $json.keys().first() + \": \" + $json.values().first().join(', ').replace(/ ([^,]*)$/, ' and $1') }} to the company.",
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.4
    },
    {
      "id": "7f2d7505-5554-4ea4-8bf9-1e05c56c2bc6",
      "name": "将员工合并到列表中",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        3700,
        1340
      ],
      "parameters": {
        "options": {},
        "fieldsToAggregate": {
          "fieldToAggregate": [
            {
              "renameField": true,
              "outputFieldName": "=employee",
              "fieldToAggregate": "displayName"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b897a173-254f-445f-a3af-db9398d0c904",
      "name": "复数化键",
      "type": "n8n-nodes-base.renameKeys",
      "position": [
        3900,
        1340
      ],
      "parameters": {
        "keys": {
          "key": [
            {
              "newKey": "=employee{{ $if($json.employee.length > 1,\"s\",\"\") }}",
              "currentKey": "employee"
            }
          ]
        },
        "additionalOptions": {}
      },
      "typeVersion": 1
    },
    {
      "id": "7e0474f1-3a9a-4b30-91eb-0b0d107d8bd1",
      "name": "在Slack上欢迎员工",
      "type": "n8n-nodes-base.slack",
      "position": [
        4480,
        1340
      ],
      "webhookId": "700f2d63-f04a-4809-9602-75f3328b56f8",
      "parameters": {
        "text": "={{ $json.output.welcome_message }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C08BWLDFS48",
          "cachedResultName": "social"
        },
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "id": "XXXXXX",
          "name": "Slack account"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "99cd4b68-a789-4a78-9636-c26554d703ed",
      "name": "便签 17",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3260,
        1240
      ],
      "parameters": {
        "color": 7,
        "width": 1380.619460919744,
        "height": 545.950640999295,
        "content": "## (为示例目的)向Slack频道发送消息欢迎新员工"
      },
      "typeVersion": 1
    },
    {
      "id": "37839a6d-b616-4e24-b24f-659064752360",
      "name": "便签 18",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4340,
        920
      ],
      "parameters": {
        "color": 3,
        "width": 342.10949704718837,
        "height": 275.27825144542527,
        "content": "## 用于测试:删除WEBHOOK"
      },
      "typeVersion": 1
    },
    {
      "id": "0e03ab51-dace-4aed-9f4e-16fbbb7f7173",
      "name": "删除BambooHR webhook",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        4460,
        1020
      ],
      "parameters": {
        "url": "=https://api.bamboohr.com/api/gateway.php/{subdomain}/v1/webhooks/{webhook_id}",
        "method": "DELETE",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBasicAuth"
      },
      "credentials": {
        "httpBasicAuth": {
          "id": "XXXXXX",
          "name": "BambooHR Basic Auth"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "81dc0021-3a7d-41f9-aef9-126143b51e9a",
      "name": "便签20",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1840,
        1440
      ],
      "parameters": {
        "width": 424.0067532215409,
        "height": 134.02025779064905,
        "content": "BambooHR的`/webhook` API端点期望参数在请求体中传递。您可以在其[文档](https://documentation.bamboohr.com/reference/post-webhook)和[示例](https://documentation.bamboohr.com/docs/webhook-api-permissioned)中查看所需参数。在我们传递的参数中,我们将webhook设置为以BambooHR速率限制相同的频率触发:每60秒一次。"
      },
      "typeVersion": 1
    },
    {
      "id": "b4a246ff-200a-40bc-a79c-4f51b24e0948",
      "name": "便签21",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2940,
        1557.4137607776859
      ],
      "parameters": {
        "width": 295.8585062958632,
        "height": 227.09133367749476,
        "content": "### 这是什么?"
      },
      "typeVersion": 1
    },
    {
      "id": "b09041d0-42b7-4084-b336-5d9af288acf9",
      "name": "获取最近的请求1",
      "type": "n8n-nodes-base.postBin",
      "onError": "continueRegularOutput",
      "position": [
        3040,
        1340
      ],
      "parameters": {
        "binId": "={{ $('Merge').item.json.binId }}",
        "resource": "request",
        "operation": "removeFirst",
        "requestOptions": {}
      },
      "typeVersion": 1
    },
    {
      "id": "ee2543e5-5fc6-48e1-a574-d351380df732",
      "name": "等待60 + 1秒让webhook触发",
      "type": "n8n-nodes-base.wait",
      "position": [
        2780,
        1240
      ],
      "webhookId": "61bbec81-dcf5-441e-b6dd-ad96b429e80d",
      "parameters": {
        "amount": 61
      },
      "executeOnce": true,
      "typeVersion": 1.1
    },
    {
      "id": "6f6a95ee-ec01-429c-8710-edc52b6cc185",
      "name": "便签19",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1740,
        780
      ],
      "parameters": {
        "color": 5,
        "width": 256.0973815349037,
        "height": 87.34661077350344,
        "content": "## 关于制作者"
      },
      "typeVersion": 1
    },
    {
      "id": "fc8344ab-f643-4bc2-af97-a2022834b3c8",
      "name": "便签22",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1740,
        520
      ],
      "parameters": {
        "color": 7,
        "width": 255.71137685448693,
        "height": 240.80136668021893,
        "content": "![image](https://media1.giphy.com/media/v1.Y2lkPTc5MGI3NjExdjM4dWFjeW1lNGVxc2Vsd2Z0aXB4cWNzZmN6aG41Y296cXVnem10eCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/5cL9WAVQREF3TkfhXj/giphy.gif#full-width)"
      },
      "typeVersion": 1
    },
    {
      "id": "58c5c5a6-2210-4506-9470-d6a55fae421a",
      "name": "便签23",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3280,
        1517.2043765224669
      ],
      "parameters": {
        "width": 410.05041971203013,
        "height": 251.31245942384516,
        "content": "## 这里发生了什么?"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "c8562d68-8706-4fe0-9983-b9ae6de379a0",
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Format payload for BambooHR webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GET Bin": {
      "main": [
        [
          {
            "node": "Format url for webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GET Bin1": {
      "main": [
        [
          {
            "node": "Format url for webhook1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Bin": {
      "main": [
        [
          {
            "node": "GET Bin",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Bin1": {
      "main": [
        [
          {
            "node": "GET Bin1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pluralize key": {
      "main": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Basic LLM Chain": {
      "main": [
        [
          {
            "node": "Welcome employees on Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split out fields": {
      "main": [
        [
          {
            "node": "Keep only new employee fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Format displayName": {
      "main": [
        [
          {
            "node": "Combine employees into list",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Auto-fixing Output Parser",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Split out employees": {
      "main": [
        [
          {
            "node": "Format displayName",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format url for webhook": {
      "main": [
        [
          {
            "node": "Register and test webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SET BambooHR subdomain": {
      "main": [
        [
          {
            "node": "GET all possible fields to monitor in BambooHR",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format url for webhook1": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GET most recent request1": {
      "main": [
        [
          {
            "node": "Split out employees",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Auto-fixing Output Parser",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Auto-fixing Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Combine fields to monitor": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Register and test webhook": {
      "main": [
        [
          {
            "node": "GET most recent request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create webhook in BambooHR": {
      "main": [
        [
          {
            "node": "Create dummy data for employees",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Combine employees into list": {
      "main": [
        [
          {
            "node": "Pluralize key",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Keep only new employee fields": {
      "main": [
        [
          {
            "node": "Combine fields to monitor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create dummy data for employees": {
      "main": [
        [
          {
            "node": "Create employee records with dummy data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Create Bin1",
            "type": "main",
            "index": 0
          },
          {
            "node": "SET BambooHR subdomain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format payload for BambooHR webhook": {
      "main": [
        [
          {
            "node": "Create webhook in BambooHR",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create employee records with dummy data": {
      "main": [
        [
          {
            "node": "Wait 60 + 1 seconds for webhook to fire",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 60 + 1 seconds for webhook to fire": {
      "main": [
        [
          {
            "node": "Check BambooHR for calls to webhook",
            "type": "main",
            "index": 0
          },
          {
            "node": "GET most recent request1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GET all possible fields to monitor in BambooHR": {
      "main": [
        [
          {
            "node": "Split out fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 人力资源, 构建模块

需要付费吗?

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

工作流信息
难度等级
高级
节点数量58
分类2
节点类型19
难度说明

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

作者
Ludwig

Ludwig

@ludwig

If you have any questions about any of the templates I've built, please reach out to me on LinkedIn (https://www.linkedin.com/in/ludwiggerdes) or via my website down below. 👇

外部链接
在 n8n.io 查看

分享此工作流