Introduction
An e-commerce wholesaler finds that 40 orders from its marketplace integration never reached its warehouse system last month. The marketplace says it sent every webhook. The application logs show nothing unusual. The orders were eventually found by a customer service agent comparing two screens.
In cloud environments, webhooks fail in quiet ways. A deploy restarts containers during a burst of events, a load balancer times out a slow handler, an autoscaler scales to zero, or a provider disables your endpoint after too many errors and sends a warning email to someone who left the company. None of these raise an alarm by default.
This article is a practical checklist, organized by stage, for building webhook handling that is observable and recoverable. Use it when designing a new integration or auditing an existing one.
Checklist: Receiving Webhooks
The receiving endpoint should do as little as possible and never depend on downstream systems being healthy.
Run the endpoint on at least two instances behind a load balancer, with health checks, so a single container restart does not drop requests.
Verify the signature using the raw request body before parsing JSON.
Write the event to durable storage, such as a database table or a managed queue, then return 2xx. Do not call other services first.
Keep handler time well under the provider's timeout, which is often 5 to 30 seconds.
Deduplicate on the provider's event ID with a unique constraint or a conditional write.
Return 4xx only for requests that will never succeed, such as a bad signature; return 5xx for anything temporary so the provider retries.
app.post("/webhooks/marketplace", rawBody, async (req, res) => {
if (!verifySignature(req.rawBody, req.headers["x-signature"])) return res.sendStatus(401);
const evt = JSON.parse(req.rawBody);
await sqs.sendMessage({
QueueUrl: INBOUND_QUEUE,
MessageBody: req.rawBody,
MessageDeduplicationId: evt.id, // FIFO queue dedupes retries
MessageGroupId: evt.data.order_id, // keeps per-order ordering
});
res.sendStatus(202);
});
Checklist: Processing Events
Processing happens asynchronously, where failures can be retried without involving the sender.
Make every handler idempotent, keyed on event ID or a business key.
Process events for the same entity in order, or design handlers to ignore events older than the current state, for example by comparing an updated_at or version field.
Retry transient failures with exponential backoff and a maximum attempt count.
Move events that keep failing to a dead-letter queue with the error attached and alert on its size.
Store the raw payload for a retention period so you can replay after fixing a bug.
Checklist: Detecting Gaps
The events you never received are the hardest to notice. Build checks that do not depend on webhooks arriving.Run a scheduled reconciliation job that lists recent objects from the provider's API and compares them with what you have.
Track events received per provider per hour, and alert when volume drops well below the normal pattern for that time of day.
Monitor the provider's dashboard or API for endpoint status, and route disabled-endpoint notifications to a monitored on-call address, not a person.
Record the last event time per provider and show it on an operations dashboard.
Checklist: Sending Webhooks
If your application sends webhooks to customers, the same discipline applies in reverse.
Generate events with a transactional outbox so they cannot be lost between commit and send.
Sign payloads and include an event ID and timestamp.
Retry with exponential backoff over a published window, such as three days.
Use a per-endpoint circuit breaker so one slow customer does not delay everyone else's deliveries.
Show customers a delivery log with status codes and a resend button.
Notify customers by email and in-app before disabling a failing endpoint.
Practical Examples: Real-World Use Cases
The wholesaler from the introduction added a reconciliation job that lists marketplace orders from the last six hours every 15 minutes. It found the cause within a day: during deploys, the old containers were killed before finishing in-flight requests. Adding graceful shutdown and moving the handler to queue-and-acknowledge stopped the losses, and the reconciliation job still catches the rare provider-side gap.
A B2B payments platform tracks event volume per provider by hour of week. When a gateway changed its webhook format and events started failing signature checks, an alert fired within 20 minutes based on the volume drop alone.
A SaaS company sending webhooks to hundreds of customers moved each customer endpoint to its own delivery queue. A customer whose server took 25 seconds per request no longer delayed events for everyone else.
Common Mistakes to Avoid
Processing events inside the HTTP handler.
Returning 200 before the event is stored.
Parsing and re-serializing the body before signature verification, which
changes the bytes and breaks the check.
Relying on webhooks alone without a reconciliation path.
Ignoring graceful shutdown, so deploys cut off in-flight requests.
Best Practices: Actionable Tips
Put this checklist into your integration design template and review it for each new provider.
Test failure modes in staging: kill containers during bursts, return 500s, and confirm replays work.
Keep one dashboard per integration with received, processed, failed, and dead-lettered counts.
Document each provider's retry policy and timeout in your runbook.
Run a replay drill every quarter so the team knows how to recover.
Conclusion
Reliable webhooks in the cloud come from a few habits applied consistently: acknowledge quickly after durable storage, process idempotently and asynchronously, detect gaps with reconciliation and volume monitoring, and send outbound events with the same care. The takeaway: assume some webhooks will never arrive, and build the job that notices when they do not.
Build Cloud Integrations That Hold Up With Parallaxis
Parallaxis builds cloud applications and integrations for B2B companies, with queue-backed webhook handling, reconciliation jobs and monitoring designed in from day one. If you are losing events between systems or planning a new integration, visit parallaxis.in to explore our cloud and development services or talk to our engineers.
Top comments (0)