← All public flows
PublicFlow #34
Tiny webhook receiver and JSON reply
Shared by Anonymous on 21 Aug 2026
13 views0 votes
About this flow
A small webhook endpoint I keep around for testing integrations. POST JSON to /hooks/device; the function normalises the fields and replies with a request id. It deliberately does not store the incoming payload anywhere.
Node-RED JSON
[{"id":"tab-hook","type":"tab","label":"Webhook receiver","disabled":false,"info":"Minimal POST endpoint with validation and a JSON response."},{"id":"http-hook","type":"http in","z":"tab-hook","name":"POST /hooks/device","url":"/hooks/device","method":"post","upload":false,"swaggerDoc":"","x":150,"y":100,"wires":[["fn-hook"]]},{"id":"fn-hook","type":"function","z":"tab-hook","name":"Normalise payload","func":"const body = msg.payload || {};\nconst device = String(body.device || 'unknown').slice(0, 80);\nmsg.payload = {\n accepted: true,\n device,\n receivedAt: new Date().toISOString(),\n requestId: msg._msgid\n};\nmsg.statusCode = 202;\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":410,"y":100,"wires":[["json-hook","debug-hook"]]},{"id":"json-hook","type":"json","z":"tab-hook","name":"Encode response","property":"payload","action":"str","pretty":false,"x":630,"y":80,"wires":[["reply-hook"]]},{"id":"reply-hook","type":"http response","z":"tab-hook","name":"202 Accepted","statusCode":"","headers":[],"x":850,"y":80,"wires":[]},{"id":"debug-hook","type":"debug","z":"tab-hook","name":"Accepted webhooks","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":660,"y":140,"wires":[]}]Visual preview
Drag to pan · Scroll to zoom