Sign in to keep reading
“Webhook Delivery System” is free with an account. Your progress and bookmarks follow you across devices.
Sign in to continueDesign a reliable webhook delivery system - handling event ingestion, guaranteed delivery, and fault tolerance at scale.
“Webhook Delivery System” is free with an account. Your progress and bookmarks follow you across devices.
Sign in to continueThink Beyond the Happy Path
Could you answer these today? Tick what you already know.
Design a webhook delivery system that enables real-time communication between applications by reliably delivering event notifications to registered endpoints.
A webhook is a mechanism that allows one application to notify another when an event occurs. Instead of constantly polling for updates, the receiving application simply waits for notifications to be pushed to its designated endpoint. This pattern is fundamental to modern integrations - from payment processing to CI/CD pipelines.
Consider an e-commerce platform like Amazon processing payments through Stripe:
Without webhooks, Amazon would need to continuously poll Stripe asking "Is the payment done yet?" - wasteful and slow. Webhooks flip this model: Stripe proactively notifies Amazon the moment something happens.
Before designing, clarify these requirements with your interviewer:
Key Questions to Ask:
The answers shape fundamental design decisions:
FR1 - Register, update, and delete webhooks
Clients can register webhook endpoints with a callback URL, specifying which event types they want to receive. They can update configurations (URL, event filters, retry policies) or delete webhooks when no longer needed.
FR2 - Receive events through webhooks
When a source application generates an event (e.g., payment processed), the webhook system delivers it to all matching registered endpoints. Clients receive HTTP POST requests containing event details.
FR3 - Filter events by type
Clients can subscribe to specific event types (e.g., only payment.succeeded and payment.failed, ignoring payment.created). This reduces noise and processing overhead for clients.
NFR1 - High Scalability
Support up to 1 billion events per day. This translates to:
NFR2 - High Availability
The system must remain available for receiving, processing, and delivering events even during partial failures. Source applications depend on reliable event ingestion.
NFR3 - Fault Tolerance with Retries
When delivery fails (client endpoint down, network issues), automatically retry with exponential backoff. After exhausting retries, move to dead letter queue for manual intervention.
NFR4 - Security
Prevent unauthorized access and data tampering. Events must be signed so clients can verify authenticity and integrity.
NFR5 - Durability
No event loss. Once an event is accepted, it must eventually be delivered (or explicitly failed after retry exhaustion).
Great candidates don't just say "high scalability" - they quantify it:
Adding specific numbers shows you understand operational constraints and can make informed tradeoffs.
POST /api/v1/webhooks
Authorization: Bearer {JWT_TOKEN}
Request:
{
"callback_url": "https://api.example.com/webhooks/payments",
"event_types": ["payment.succeeded", "payment.failed"],
"retry_config": {
"max_retries": 5,
"initial_delay_ms": 1000,
"max_delay_ms": 30000,
"backoff_multiplier": 2.0
}
}
Response: 200 OK
{
"webhook_id": "wh_abc123",
"signing_secret": "whsec_xyz789", // Client uses this to verify payloads
"status": "active",
"created_at": "2025-01-15T10:30:00Z"
}
The signing_secret is critical - clients use it to verify that incoming webhook payloads actually came from our system and weren't tampered with.