Webhooks vs Polling: How Should Your Systems Talk?
When two systems need to share data, one of them has to find out when something changes. There are two common ways to do that: the sender can push an event as it happens (a webhook), or the receiver can ask on a schedule (polling). Each has a place, and most dependable integrations use both.
What a webhook is
A webhook is an HTTP request that a service sends to a URL you provide when an event occurs, such as a payment succeeding or a form being submitted. You do not have to ask; the data arrives when it is ready. A typical payload looks like this:
// Illustrative example { "event": "order.created", "id": "evt_1042", "data": { "order_id": "A-2291", "status": "paid" } }
What polling is
Polling means your system calls the other service’s API every so often and asks, “anything new since last time?” It is simple and under your control, but it wastes requests when nothing has changed and it introduces a delay equal to your polling interval.
How they compare
- Speed. Webhooks arrive almost immediately. Polling is only as fresh as its interval.
- Efficiency. Webhooks send data only when something happens. Polling makes requests whether or not anything changed, which can run into rate limits.
- Simplicity. Polling needs no public endpoint on your side. Webhooks need a reachable URL and code to receive and verify requests.
- Reliability. Polling can recover from missed changes by asking again. A webhook that fails to arrive may be lost unless the sender retries.
- Availability. Not every service offers webhooks, and some offer them only for certain events. Check the documentation.
Practices every webhook receiver needs
- Verify the sender. Check the signature or secret the service provides so you can reject forged requests.
- Respond quickly. Acknowledge receipt right away and do the heavy work afterwards, for example from a queue, so the sender does not time out and retry.
- Handle duplicates. Senders often retry, so the same event can arrive more than once. Use the event ID to make processing idempotent: handling it twice should have the same effect as handling it once.
- Do not rely on order. Events can arrive out of sequence. Use timestamps or fetch the current state when order matters.
- Log everything. Keep a record of what arrived and what you did, so failures can be investigated and replayed.
Use both when it matters
A common and robust design is to use webhooks for speed and add a periodic reconciliation job that polls for anything missed. If a webhook is lost, the next reconciliation run catches it. For low-volume or low-urgency data, polling alone may be enough and is easier to run.
Choosing
Ask three questions: how quickly do you need to know, does the service support webhooks for the events you care about, and what is the cost of missing one? If speed matters and webhooks are available, use them and add a safety net. If not, poll at a sensible interval and respect the service’s rate limits.
See our API Integration services for how we approach connecting systems.