When to activate
- Designing webhook event system for API platform
- Implementing webhook payload schemas and signing
- Building retry and delivery guarantee mechanisms
- Creating webhook management UI/API for subscribers
- Setting up webhook testing and debugging tools
When NOT to use
- For real-time push via WebSockets/SSE
- For message queue consumer design
- For event sourcing architectures
Instructions
- Define event types. Catalog events:
user.created, order.completed, payment.failed, etc. with JSON schemas.
- Design payload structure. Standard wrapper:
{ id, type, timestamp, data: { ...event-specific } }. Include API version.
- Implement signing. HMAC-SHA256 signature in
X-Webhook-Signature header using shared secret.
- Build delivery system. Async queue (Redis/BullMQ), exponential backoff retries (1s, 5s, 30s, 5min, 1h), max 5 attempts.
- Add management API. Endpoints to create/list/update/delete webhook subscriptions with URL, events, and secret.
- Implement verification. Challenge-response verification on subscription creation; signature validation on delivery.
- Monitor delivery. Dashboard: delivery success rate, latency p95, failure reasons, and dead letter queue.
Example
{
"id": "evt_abc123",
"type": "order.completed",
"apiVersion": "2026-06-01",
"timestamp": "2026-06-13T10:30:00Z",
"data": {
"orderId": "ord_789",
"customerId": "cust_456",
"total": 149.99,
"currency": "USD",
"items": 3
}
}
Headers:
X-Webhook-Signature: sha256=a1b2c3d4...
X-Webhook-ID: evt_abc123
X-Webhook-Timestamp: 1718271000
1---2name: webhook-builder3description: Design and implement webhook systems with payload signing, retry logic, and delivery monitoring4---56## When to activate78- Designing webhook event system for API platform9- Implementing webhook payload schemas and signing10- Building retry and delivery guarantee mechanisms11- Creating webhook management UI/API for subscribers12- Setting up webhook testing and debugging tools1314## When NOT to use1516- For real-time push via WebSockets/SSE17- For message queue consumer design18- For event sourcing architectures1920## Instructions21221. **Define event types.** Catalog events: `user.created`, `order.completed`, `payment.failed`, etc. with JSON schemas.232. **Design payload structure.** Standard wrapper: `{ id, type, timestamp, data: { ...event-specific } }`. Include API version.243. **Implement signing.** HMAC-SHA256 signature in `X-Webhook-Signature` header using shared secret.254. **Build delivery system.** Async queue (Redis/BullMQ), exponential backoff retries (1s, 5s, 30s, 5min, 1h), max 5 attempts.265. **Add management API.** Endpoints to create/list/update/delete webhook subscriptions with URL, events, and secret.276. **Implement verification.** Challenge-response verification on subscription creation; signature validation on delivery.287. **Monitor delivery.** Dashboard: delivery success rate, latency p95, failure reasons, and dead letter queue.2930## Example3132```json33{34 "id": "evt_abc123",35 "type": "order.completed",36 "apiVersion": "2026-06-01",37 "timestamp": "2026-06-13T10:30:00Z",38 "data": {39 "orderId": "ord_789",40 "customerId": "cust_456",41 "total": 149.99,42 "currency": "USD",43 "items": 344 }45}4647Headers:48X-Webhook-Signature: sha256=a1b2c3d4...49X-Webhook-ID: evt_abc12350X-Webhook-Timestamp: 171827100051```