Guide
APIs & integration
Webhooks explained
What webhooks are, how they differ from polling, and how to receive them securely and reliably.
Overview
A webhook is an HTTP callback: instead of your app repeatedly polling a provider for changes, the provider sends an HTTP POST to a URL you register whenever an event occurs. It’s the difference between refreshing your inbox and getting a notification.
Polling vs webhooks
- Polling: simple, but wasteful and laggy — you ask constantly, mostly to hear “nothing changed”.
- Webhooks: efficient and near-real-time, but you must run an endpoint and handle delivery quirks.
Receiving webhooks securely
- Verify the signature. Providers sign payloads (often HMAC). Compute the signature and compare — reject anything that doesn’t match. This prevents forged events.
- Use HTTPS so payloads aren’t readable in transit.
- Treat the payload as untrusted input and validate it.
Reliability
- Respond fast (2xx) and process later. Do the real work asynchronously via a queue; providers often time out slow endpoints and retry.
- Expect retries and duplicates. Make handling idempotent — processing the same event twice must be safe (dedupe on an event id).
- Handle out-of-order delivery. Don’t assume events arrive in sequence; use timestamps or versioning.
Common mistakes
- Doing heavy work synchronously in the handler and timing out.
- Not verifying signatures (accepting spoofed events).
- Assuming exactly-once delivery.
Related
Last verified: August 2026. Technology and pricing change — always confirm current details with the vendor.