Webhooks Explained: Real-Time Integrations Between Business Systems
Webhooks let one system notify another the moment something happens. Here's how they work, how they differ from APIs and polling, and how to make them reliable.
Super Admin
·
·
2 min read
Short answer: A webhook is an HTTP request that one system sends to another when an event happens, such as "payment succeeded" or "order shipped." Instead of repeatedly asking for updates (polling), the receiving system is notified immediately. Reliable webhook integrations verify signatures, respond quickly, process events in the background, handle retries and duplicates, and are monitored.
Webhooks vs polling
| Polling | Webhooks | |
|---|---|---|
| How it works | Your system asks "anything new?" on a schedule | The other system tells you when something happens |
| Speed | Delayed until the next check | Near real-time |
| Efficiency | Many empty requests | Requests only when needed |
| Complexity | Simple | Needs a public endpoint and careful handling |
Many integrations use both: webhooks for speed and occasional polling or reconciliation as a safety net.
Anatomy of a webhook
POST /webhooks/payments HTTP/1.1
Content-Type: application/json
X-Signature: t=1700000000,v1=5257a869...
{
"id": "evt_123",
"type": "payment.succeeded",
"data": { "order_id": "1042", "amount": "125.50", "currency": "USD" }
}
Building reliable receivers
1. Verify the signature
Use the shared secret to confirm the request came from the expected sender and wasn't altered.
2. Respond fast
Return a success response quickly, then process the event in a background job. Slow responses cause timeouts and retries.
3. Handle duplicates
Senders may deliver the same event more than once. Store processed event IDs and ignore repeats.
4. Don't rely on order
Events can arrive out of sequence. Use timestamps or fetch the latest state from the sender's API when order matters.
5. Retry and dead-letter handling
If processing fails, retry with backoff, and move permanently failing events to a queue for review.
6. Monitor
Alert on repeated failures and track how many events are received and processed.
Example: shipping updates
An online store uses a courier service:
- The courier sends
shipment.picked_up,shipment.in_transitandshipment.deliveredwebhooks. - The store verifies each signature, records the event ID and queues processing.
- A background job updates the order status and emails the customer.
- If
deliveredarrives beforein_transit, the job keeps the most advanced status. - A nightly job compares open shipments with the courier's API to catch any missed events.
Frequently asked questions
Are webhooks secure? They can be, with HTTPS, signature verification and secrets kept safe.
What if our server is down? Most senders retry for a period. Reconciliation jobs catch anything missed.
Next steps
List the events your systems need to share in real time. CodeFoTech builds webhook-based integrations through our custom software development and AI and automation services.
Was this article helpful? Thanks for your feedback.