Skip to content
IT glossary
BackendUpdated December 3, 2026

Webhook

Вебхук

A webhook lets one service notify another about an event by sending an HTTP request to a configured address. The receiving service doesn't have to keep asking whether anything has changed.

What is a webhook?

Say your app asks a shipping provider to create a delivery. The API response confirms that the delivery was created, but the parcel won't arrive until later. Instead of making your app check the delivery status every minute, the provider can send it an HTTP request when the parcel arrives. That event-triggered request is a webhook. Your app acts as the HTTP server for the incoming notification, even though it was the client when it created the delivery.

What happens during delivery?

You register a URL with the provider and select the events you want to receive. When one occurs, the provider typically sends a POST request with a JSON body. A successful 2xx response usually tells the provider that your endpoint accepted the notification, not that every downstream task has finished. The provider defines which failures trigger retries and how long it keeps trying.

Example: a parcel arrives

The shipping provider sends this body to POST /webhooks/shipping:

{"event_id":"evt_51","type":"parcel.delivered","parcel_id":"p_104"}

The endpoint checks the request and saves the event to a database or a durable queue before responding. A worker can then update the order and schedule the customer notification without keeping the HTTP request open. Saving the event first matters: if you return success while the event lives only in memory, a crash can erase it without giving the provider a reason to retry.

Common mistakes and trade-offs

  • Assuming delivery happens exactly once. The provider may retry if your endpoint saves the event but the response gets lost. Use the provider's stable event ID to recognize repeat deliveries. For a database update, record that ID and apply the update in one transaction, using a unique constraint to handle concurrent deliveries.
  • Assuming events arrive in order. A delayed retry for an older status can arrive after parcel.delivered. Use a version number if the provider supplies one, or fetch the current state when you can't determine which update is newer.
  • Treating HTTPS as proof of who sent the request. HTTPS protects data in transit. To verify the sender, follow the provider's signature scheme, using the original request bytes when the scheme requires them.

Where webhooks fit

Payment providers use them to report completed payments, source control platforms use them to trigger builds, and shipping providers use them to report status changes. Unlike a WebSocket, a webhook doesn't need a persistent two-way connection. Unlike polling, it needs an endpoint the sender can reach. The two approaches can complement each other: webhooks give you prompt updates, and a periodic API check can reconcile missed events when the provider doesn't guarantee delivery.

What interviewers look for

Expect to explain where you acknowledge a request and what happens if something fails on either side of that point. A strong answer distinguishes accepting an event from processing it and explains why retrying must not repeat the business effect.