Api Design medium
Your API sends webhooks to customers' endpoints. If their server is down, the webhook is lost. How do you make webhooks reliable?
- A Implement an asynchronous delivery queue with exponential backoff retries and provide an events API to let clients query for missed notifications.
- B Switch from HTTP to a connection-oriented protocol like raw TCP or WebSocket to maintain a persistent link between the sender and every client endpoint.
- C Use a Fire-and-Forget pattern where the sender ignores HTTP error status codes, assuming the client or intermediate proxies will eventually resolve the delivery.
- D Require clients to implement a Distributed Lock on their webhook endpoint to ensure that only a single, confirmed delivery can occur at any given time.
Answer: A. Implement an asynchronous delivery queue with exponential backoff retries and provide an events API to let clients query for missed notifications.
Webhooks rely on the public internet and receiver availability, making delivery unreliable. To guarantee delivery, the sender must implement **retries with exponential backoff**. Additionally, providing a mechanism to verify delivery (like manual replay or an event log API) covers cases where retries are exhausted.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- You're designing a REST API for a blog. Which endpoint best represents 'get all comments for post 123'?
- A client wants to update only the 'status' field of an order, leaving other fields unchanged. Which HTTP method is most appropriate?
- A client calls POST /users with valid data, and the user is created. What status code should the server return?
- A client retries a failed 'POST /payments' request due to network timeout. The server receives the request twice. Without idempotency handling, what can happen?
- An API returns 10,000 products. Returning all in one response is impractical. Which pagination approach is simple and stateless?
- Your API serves both mobile apps and third-party integrations. Which authentication method is most appropriate?