Analyst Bootcamp Join on TelegramJoin
Junior+ · Systems Analysis

Integration patterns: sync call, webhook, polling, queue

🕥 10 min read🧭 SA📅 updated 2026-10-15Читать на русском

Every integration is a choice between four ways of moving information: ask and wait, be told, keep asking, or leave a message. How to pick for a given flow, what each one costs in failure handling, and how to draw it as a sequence diagram the team can review.

One flow, four ways to build it

A customer pays; the shop must learn whether the payment succeeded and then ship. Four honest designs exist, and the team will build whichever one the ticket implies, so the ticket had better choose.

PatternHow information movesLatencyWhat can go wrong
Synchronous callwe call them and wait for the answer in the same requestmillisecondstheir slowness becomes our slowness; timeouts leave us not knowing
Webhookthey call us when something happenssecondswe may be down; events arrive twice, late, or out of order
Pollingwe ask them every N seconds or minutesNwasted calls; rate limits; "did we miss one?"
Queue / eventone side writes a message, the other reads when readyseconds to minutesmessages pile up; ordering and duplicates must be handled

None is "best". The choice depends on three questions you can answer for any flow in five minutes.

The three questions

  1. Does the user wait for the answer? If the customer is looking at a spinner, the first step has to be synchronous (or feel like it). Nobody waits for a nightly report; that is a queue or a batch.
  2. Who knows first? If the other system learns about the event (payment settled, parcel scanned), a webhook or their event stream is the natural source. If only we know (we created an order), we push.
  3. What happens if a message is lost or doubled? Money, stock and legal records need delivery guarantees and idempotency. A "recommended for you" update does not.

For the payment flow the answers are: yes, the user waits for the attempt; the provider knows the outcome first; a doubled "paid" must not ship twice. So: synchronous call to start, webhook to confirm, polling as a safety net, and idempotency on the handler. That combination is what most payment integrations actually look like.

Start synchronously, confirm by webhook, poll only when the webhook is late; the handler must tolerate duplicates.
Start synchronously, confirm by webhook, poll only when the webhook is late; the handler must tolerate duplicates.

Synchronous call: the rules that make it safe

Webhook: the rules

Polling: when it is the right answer

Polling is unfashionable and often correct: when the other side offers no webhook, when volume is small, when a few minutes of delay are fine. Rules: an interval the other side tolerates (read their rate limit), a since parameter or a cursor so that you ask only for what is new, and backoff when they answer 429 or 503.

Queue: when the work can wait

A queue decouples "the order is placed" from "the warehouse is told". The order service writes a message; the warehouse integration reads it when ready; if the warehouse system is down for an hour, nothing is lost, it is just late. Rules: a dead-letter queue for messages that fail repeatedly (and a person who reads it), idempotent consumers, and a ticket line about ordering ("messages for the same order are processed in order; across orders, order does not matter").

Drawing it: the sequence diagram

The artefact that gets an integration reviewed is a sequence diagram: participants across the top, time downwards, one arrow per message, with the failure branches drawn in. Three rules for a diagram developers trust:

Checkout      -> Payment provider : POST /payments (amount, idempotency key)   [timeout 5 s]
Payment prov. -> Checkout         : 201 pending (payment_id)
Payment prov. -> Orders service   : webhook payment.succeeded (event_id, payment_id)
Orders        -> Orders           : seen event_id before? yes → 200 and stop
Orders        -> Orders           : order status New → Paid; reserve stock
Orders        -> Payment prov.    : GET /payments/{id} every 60 s if no webhook in 5 min

The same content as the picture above, in text, for the ticket. Both are fine; the reviewer needs one of them.

With AI

Models explain the patterns well and can draft a sequence diagram from a paragraph. They tend to produce the happy path and forget the reconciliation sentence, the timeout value and the duplicate handling. Use the draft, then add the three unhappy arrows yourself; that is the whole analytical content of the ticket.

Try it (5–10 minutes)

Flow: "When a customer's parcel is delivered, send them a review request 24 hours later, unless they have already returned the item."

  1. Answer the three questions. Which parts are webhook, queue, poll, synchronous?
  2. Write the sequence in text (as above) with at least three unhappy arrows: carrier webhook lost, duplicate delivered event, return registered during the 24 h.
  3. Fill the sentence: "If the delivered event never arrives, we find out by ___ within ___."

Where this shows up in real work

  • System analyst and integration analyst job posts ask for "designing integrations with third-party systems", "webhooks", "message queues" and "sequence diagrams"; the interview is usually a payment or shipping flow.
  • In real incidents, "we never got the webhook" and "we processed it twice" are the two most common integration post-mortems; the reconciliation sentence and the idempotency rule are the fixes.
  • Freelance "connect A to B" projects are scoped by the pattern: a webhook with reconciliation is a different estimate from a nightly file, and the client needs to hear which one they are buying.

Sources worth reading

Practice it on real drills

Integration between two systemsSync vs async / batch vs real-time decisionEvent-driven design (events & consumers)

Finished reading and did the exercise?