Receiving Webhooks
Build a webhook receiver — verify signatures, dedupe deliveries, and handle retries.
Use webhooks to react to async flow runs without polling. This guide walks through a minimal Node and Python receiver and explains the must-handle cases.
1. Get your signing secret
In the Noukai dashboard, open Settings → Webhooks and click Rotate to issue a secret. The dashboard shows the full plaintext once — copy it into your secrets store immediately. After dismissal you can only see a masked preview.
You can also rotate via the API — see POST /organizations/{org_id}/webhooks/secret/rotate (admin-only).
2. Subscribe a job
Pass callbackUrl on the async /jobs endpoint:
Optionally, restrict the events you receive:
Webhooks fire only on /jobs. Sync /execute and step-through /step ignore callbackUrl.
3. Stand up the receiver
The receiver must:
- Read the raw request bytes before any JSON parsing.
- Verify
X-Noukai-Signatureusing your signing secret. - Dedupe on
X-Noukai-Delivery. - Return
2xxquickly (under 20 s).
Node (Express)
Python (FastAPI)
4. Rotate the secret without downtime
When you rotate, Noukai signs every delivery with both the new and previous secret for 24 hours (the v2= slot in X-Noukai-Signature). The verifier code above accepts either match, so you can:
- Rotate via dashboard or API → save the new plaintext.
- Deploy the new secret to your receiver.
- Old and new pods both keep verifying — old pods match on
v2, new pods match onv1. - After the grace window ends, only
v1is sent and the rollover is complete.
5. Inspect deliveries
The dashboard's Settings → Webhooks → Recent deliveries table mirrors GET /organizations/{org_id}/webhooks/deliveries. Use it to:
- See which deliveries succeeded vs. retried vs. dead-lettered.
- Read the response status and error excerpt Noukai recorded.
- Find a
X-Noukai-DeliveryUUID to correlate with your receiver logs.
Checklist
- HTTPS URL that resolves to a public IP (private IPs are blocked).
- Verify against raw body bytes — not re-serialized JSON.
- Dedupe on
X-Noukai-Deliverybefore doing any side effect. - Return
2xxquickly. Defer heavy work to a queue. - Treat 3xx as misconfiguration — Noukai disables redirects and records 3xx as permanent failure.
- On
payload.truncated === true, fetch full output fromGET /seq/.../jobs/{executionId}.
Related
- Webhooks API — full reference for endpoints, headers, signing, and retries.
- Slug Execution API — Async — the
/jobsendpoint that produces webhook events.