{ "name": "HC-WP: Statusプッシュ通知", "nodes": [ { "id": "webhook-status-push", "name": "Webhook", "type": "n8n-nodes-base.webhook", "typeVersion": 2, "position": [ 220, 300 ], "webhookId": "healthcheck-status-push", "parameters": { "httpMethod": "POST", "path": "healthcheck-status-push", "responseMode": "responseNode", "options": {} } }, { "id": "dt-get-healthcheck_wp_api_key", "name": "HEALTHCHECK_WP_API_KEY取得", "type": "n8n-nodes-base.dataTable", "typeVersion": 1, "position": [ 440, 300 ], "parameters": { "operation": "get", "dataTableId": { "__rl": true, "mode": "id", "value": "bNkadTyDgDepYx2p" }, "filters": { "conditions": [ { "keyName": "configKey", "keyValue": "HEALTHCHECK_WP_API_KEY" } ] }, "returnAll": true } }, { "id": "code-validate", "name": "検証", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 660, 300 ], "parameters": { "jsCode": "const expectedApiKey = $('HEALTHCHECK_WP_API_KEY取得').item.json.configValue;\nconst headers = $input.first().json.headers || {};\nif (headers[\"x-api-key\"] !== expectedApiKey) {\n throw new Error(\"Unauthorized: invalid API key\");\n}\nconst body = $input.first().json.body || {};\nif (!body.resultId || !body.processId) {\n throw new Error(\"Bad Request: resultId, processId は必須です\");\n}\nreturn [{ json: { resultId: body.resultId, processId: body.processId } }];" } }, { "id": "execute-hc-sub", "name": "HC-SUB実行", "type": "n8n-nodes-base.executeWorkflow", "typeVersion": 1.2, "position": [ 880, 300 ], "parameters": { "workflowId": { "__rl": true, "mode": "id", "value": "XRqcykbG2LuAjGG2" }, "workflowInputs": { "mappingMode": "defineBelow", "value": { "resultId": "={{ $json.resultId }}", "processId": "={{ $json.processId }}" } } } }, { "id": "respond-ok", "name": "Respond to Webhook", "type": "n8n-nodes-base.respondToWebhook", "typeVersion": 1.1, "position": [ 1100, 300 ], "parameters": { "respondWith": "json", "responseBody": "={{ JSON.stringify({ result: \"ok\" }) }}", "options": {} } } ], "connections": { "Webhook": { "main": [ [ { "node": "HEALTHCHECK_WP_API_KEY取得", "type": "main", "index": 0 } ] ] }, "HEALTHCHECK_WP_API_KEY取得": { "main": [ [ { "node": "検証", "type": "main", "index": 0 } ] ] }, "検証": { "main": [ [ { "node": "HC-SUB実行", "type": "main", "index": 0 } ] ] }, "HC-SUB実行": { "main": [ [ { "node": "Respond to Webhook", "type": "main", "index": 0 } ] ] } }, "settings": { "executionOrder": "v1" } }