event_id once, and order events
within each run_id by sequence.
Prerequisites
- A key with both
runs:readandruns:writeto create or change an endpoint. - A public HTTPS endpoint on the default port. Localhost, IP literals, private networks, embedded credentials, and unsafe redirect targets are rejected.
- A secret manager for the one-time
signing_secret.
1. Create an endpoint
signing_secret immediately. It is returned only when the
endpoint is created.
2. Verify the raw request
Every delivery includes:lib/praxa-webhook.ts
3. Handle deliveries in your framework
- Next.js
- Express
- Cloudflare Worker
app/api/webhooks/praxa/route.ts
persistOnce must commit a unique event_id before returning 2xx. A duplicate
event should return success without repeating its downstream effect.
4. Test the signature locally
5. Verify production delivery
- Deploy the HTTPS endpoint and create it in Praxa.
- Trigger a disposable task whose event filter matches the endpoint.
- Require a valid signature and matching header/body
event_id. - Require the handler to persist the event before returning
204. - Send the same signed event twice in a controlled test and require one logical effect.
- Send an expired timestamp and a one-byte body change and require
401. - List deliveries with
GET /v1/webhook-deliveriesand require the expected endpoint and run IDs. - Exercise replay only after correcting a failed endpoint; replay must remain idempotent.
Troubleshooting
Best practices
- Persist identity before I/O and state transitions after durable processing.
- Treat admission, delivery attempt, and cancellation request as non-terminal acknowledgements.
- Verify signatures against the raw body before parsing webhook JSON.
- Deduplicate streams and webhooks using stable event or delivery identity.
- Test disconnect, duplicate, out-of-order, timeout, revocation, and cleanup paths.
Optimize for production
- Prefer event-driven updates while retaining bounded polling or readback reconciliation.
- Commit cursors in batches only when that cannot lose acknowledged application work.
- Keep webhook handlers short: verify, persist, acknowledge, then process asynchronously.
- Measure admission-to-terminal time, reconnect rate, duplicate rate, delivery latency, and reconciliation backlog.
Cleanup and next steps
- Cancel or terminally reconcile disposable runs.
- Disable test webhook endpoints and remove their signing secrets.
- Delete synthetic inbox, cursor, and delivery records after assertions.
- Revoke disposable credentials and keep only redacted lifecycle evidence.