All articles
10 min read

Webhooks vs Polling: How to Choose for Your Integration

A cream 1980s desk telephone with its handset off the cradle sits on a bare grey counter next to a brass wind-up timer and a small card, with an amber indicator lamp glowing on a panel at the edge.

Webhooks and polling are two ways to learn that something changed in another system. With polling, your software asks on a schedule. With a webhook, the other system tells you when it happens. For most business software the right answer is a webhook for speed, plus a slow, low-frequency poll as a safety net. We build integrations between shops, CRMs, ERPs and custom platforms at Ampersand, and this is the pattern we reach for when the stakes are real: orders, payments, customer records.

Below you get the plain definitions, the tradeoffs with numbers, a decision guide, and the mistakes that cause silent data loss.

TL;DR

  • Polling means your system asks the other system for changes at a set interval. It is simple to build and easy to recover, but it is slow and sends many empty requests.
  • Webhooks mean the other system sends you an HTTP request when an event occurs. They are fast and cheap, but you must host a public endpoint and handle retries, duplicates and missed events.
  • Use webhooks for time-sensitive, irregular events (payments, orders, alerts). Use polling when the source has no webhooks, volume is low, or you need to reconcile full state.
  • The robust design for most products is both: webhook-first delivery, plus periodic polling that catches anything missed.

What polling and webhooks actually are

Polling is client-driven. Your software sends a request to an API endpoint at set intervals to check for new data, events or job status, and you control the timing. A typical flow: you submit work, receive a job ID, ask the status endpoint every few seconds, and stop when the job succeeds or fails.

A webhook reverses the direction. You give the other system a URL once and say which events you care about. From then on, it sends an HTTP request with the event data whenever one occurs, instead of you calling the API to check. Webhooks are sometimes called reverse or push APIs, though an application still needs an API to use a webhook.

If you wonder whether a webhook is the same as a callback URL: in practice, yes. A webhook is a registered callback URL that the server calls when it has something new to report.

The tradeoffs that matter

Criterion Polling Webhooks
Latency Bounded by the interval Near real time, usually seconds
Load Constant, mostly empty requests One request per actual change
Build effort A loop, a checkpoint, an API call Public endpoint, authentication, fast response, queue, dedupe, retries
Missed events Rare: the next poll asks again Possible, so you must design for it
Ordering You read in the order you choose Can arrive out of order under retries
Needs inbound access No Yes, a reachable HTTPS endpoint

The comparison in this table follows PartnerMatch’s analysis, and it sums up the asymmetry well: webhooks win on what customers feel (freshness), polling wins on what engineers feel at 2 a.m. (simplicity and recovery).

Latency

Polling can never be faster than its interval. Nylas gives a concrete figure: on a 5-minute cycle, the average delay is 2.5 minutes, against seconds for webhooks. If a customer is waiting for an order confirmation or a status change in your app, that gap is visible.

Cost and load

Empty requests add up. Hook0 quantifies it: a webhook-based setup made 2,400 API calls per day versus 14.4 million for the equivalent polling setup. Beyond wasted compute, frequent polling eats your API quota. Asaas warns that it can trigger HTTP 429 Too Many Requests errors, the signal that you have exceeded the provider’s rate limit.

A Swedish academic study of push versus pull notification, published through the DiVA repository, found webhooks performed better at almost every measured point, with lower and more even CPU usage. For a typical small or mid-size business integration you will never approach the client counts where both methods break down; the point is the direction of the difference.

Reliability

This is where polling earns its keep. A poll asks “what changed since my last checkpoint?”, so a failure just means the next poll catches up. A webhook is a single delivery attempt that depends on your server being up and answering correctly. Webhooks usually promise at-least-once delivery, which means the same event may arrive more than once and your processing must tolerate that.

When to use webhooks

Choose webhooks when events are irregular or time-sensitive and you can expose an endpoint. Hookdeck lists payment events, order updates, CI results and messaging as typical cases. Concretely:

  • A customer pays and your shop must release the order. Waiting for the next poll delays fulfillment and support questions pile up.
  • Fraud or security alerts. Edana, as summarized by Nylas’ guidance, treats webhooks as generally indispensable here, while catalog updates or periodic reports may be fine with polling.
  • Live, user-facing sync. New mail, calendar changes, anything a person watches on screen. Nylas recommends webhooks for exactly this.
  • Many resources to watch. GitHub notes webhooks scale better than per-resource API calls and avoid exhausting rate limits.

When polling is the better choice

Polling is a deliberate engineering choice, not a fallback for the lazy. PartnerMatch advises it when:

  • the partner system offers no webhooks;
  • event volume is low (a few changes a day make a 15-minute poll cheap);
  • you cannot tolerate any missed event, such as financial records or compliance-relevant state;
  • you cannot host a reliable public endpoint;
  • the downstream work is batch by nature.

There is also the firewall case. Tyk points out that webhooks suit poorly where an app cannot expose a public endpoint, such as mobile and browser apps or systems behind a firewall. And for full-state consistency, polling gives a snapshot each time, which makes deletions and reconciliation easier to detect.

A note on one limit: a poll returns the current state, not the history. If an order moves through three statuses between two polls, you only see the last one. If you need every step, use a cursor-based change feed or webhooks.

Why most products need both

The practical design is webhook-first with a polling safety net. Nylas notes that webhooks give sub-10-second freshness while polling provides a guaranteed catch-up path when an event is missed. Hook0 recommends a low-frequency fallback, for example hourly, with both paths feeding one idempotent processor.

The reason is blunt: a webhook integration without retries and reconciliation is faster than polling right up until the day it silently drops an event. After that it is worse, because polling would have caught it.

A Swiss example of a product offering both: the KonkursRadar API for SHAB insolvency data lets subscribers either poll the API or register a signed HTTPS webhook endpoint for events such as new filings and watchlist matches, filtered by procedure type and canton.

One caveat on design: if the source offers webhooks but no reliable way to read data back, that is a fragile dependency. Check for a list or update API before committing to a webhook-only design.

Building webhooks that do not lose data

Receiving a webhook is easy. Receiving it correctly is the work. These are the points that decide whether an integration holds up.

1. Acknowledge fast, process later

Queue the raw request body on arrival and return a 2xx response immediately; do the real work afterwards. Providers time out. GitHub expects a response within 10 seconds, and a slow handler is treated as a failure and triggers retries.

2. Make processing idempotent

Idempotent means running the same operation twice has the same effect as running it once. Key it on the provider’s stable event ID and record that ID in the same database transaction as the work, protected by a unique constraint. Return 200 for duplicates rather than an error, since erroring on a harmless duplicate only creates more retries. A check-then-create handler has a race, where two deliveries both read “not seen” before either writes, so the claim must be one atomic operation.

An event-ID check does not cover two different events describing the same state change. For side effects such as payments or emails, pass idempotency keys to payment APIs, use upserts and check current state first.

3. Expect disorder

Retries can deliver events out of order. Compare payload timestamps against the stored state and discard stale events, or fetch the current object from the API instead of trusting the payload.

4. Verify who is calling

Anyone can post to a public URL, so verify the sender. Common protections are a secret key in the request header, mutual TLS and encryption on the webhook URL. The most common implementation is a signature computed over the raw request body, and the details of getting that right are covered in a guide to verifying webhook signatures. For production patterns around retries, repeated events and recovery, this overview of signing, idempotency and replay is a good companion.

5. Plan for retries and dead endpoints

Providers differ. Stripe retries live-mode events for up to three days, while GitHub does not automatically redeliver failed deliveries. Some providers disable endpoints that keep failing, so alert when expected events stop arriving. One published reference schedule, from SitePoint’s pre-ship guide, has eight attempts over a little more than 27 hours.

6. Reconcile on a schedule

Run a nightly or hourly job that lists objects changed since the last checkpoint and processes them through the same idempotent code. That is your polling safety net.

Getting polling right

If polling is your choice, a few rules keep it healthy:

  • Set the interval from how often the data actually changes, and use exponential backoff with jitter after failures, so retries spread out instead of hammering a recovering server.
  • Use conditional requests where the API supports them, and set a deadline or maximum attempt count for job polling.
  • Avoid boundary bugs. If your last run stored 08:00:00 and the next query asks strictly after it, a record stamped exactly 08:00 can be missed. Keep a small look-back window, deduplicate by stable ID, and advance the checkpoint only once every item on the page is processed.
  • Where available, prefer a pair such as (updated_at, id) over a bare timestamp, since two records can share a timestamp.

What about Kafka and WebSockets?

These solve neighboring problems. Kafka is not HTTP-native, so a webhook cannot be posted straight to a broker; a small HTTP listener has to sit in front. A useful rule of thumb from Engineering Atlas: webhooks for telling another company’s server, WebSockets for telling a live user, and a stream like Kafka for telling your own services. Between your own services with strict ordering or high volume, a stream is the better fit than webhooks.

Putting it together: a quick decision guide

  1. Does the source offer webhooks? If not, you poll.
  2. Can you host a reliable public HTTPS endpoint? If not, you poll.
  3. Is a delay of minutes acceptable and volume low? Polling is enough and simpler.
  4. Is the event time-sensitive or money-related? Webhooks, plus reconciliation polling.
  5. Can you afford to lose one event? If not, always add the polling safety net.

Where a senior team saves you the 2 a.m. call

The expensive part of an integration is not the first happy-path delivery. It is the duplicate event that double-ships an order, or the silent gap that nobody notices for a week. Ampersand builds system integrations and API connectivity for shops, CRMs and ERPs, and our projects are led end-to-end by senior engineers from first consultation to handover, so the person who designs your event flow is the one who answers for it. If you are connecting systems, replacing an old polling script or automating a business process, see the integration and support options on our pricing page. Our Run & monitor plan for ongoing support is listed at 750 CHF per month.

FAQ

Is a webhook the same as polling?

No. They are opposites in direction. In polling your system keeps asking whether something changed. With a webhook the other system sends you a request when something changes. Many integrations combine them.

Are webhooks free?

The mechanism itself is part of the HTTP protocol, and many providers include webhooks in their API at no extra charge. Your cost is in building and running the receiving endpoint: authentication, queueing, deduplication and monitoring. Check each provider’s plan for specifics.

Is a webhook the same as Kafka?

No. A webhook is a single HTTP POST from one server to another, suited to occasional notifications. Kafka is a distributed platform with durable logs, ordering per key and replay, suited to connecting many of your own services.

How often should I poll?

Match the interval to how often the data really changes. A 15-minute poll can be acceptable in low-volume contexts, and a reconciliation poll behind webhooks can run hourly or nightly. If you find yourself polling every minute across many customers, you likely hit rate limits and need webhooks.

Sources

Talk to us

Have a project this touches on?

A free 10-minute call is the fastest way to find out whether we are the right studio for it.

Book a free 10-min call