Webhooks connect your systems to payment gateways, shops, CRMs, messaging platforms and SaaS tools. They look simple: another service sends an HTTP request when something happens. In practice they arrive late, twice, out of order, in bursts, or not at all if your server was down. A small amount of structure turns them from a source of mysterious bugs into dependable integration.
Receive: Verify, Store, Acknowledge
POST /webhooks/gateway
1. Read the raw body (before parsing) and verify the signature header.
2. Insert {event_id, source, type, payload, received_at} into webhook_events
(unique index on source + event_id).
3. Enqueue a job with the row ID.
4. Return 200 immediately.
- Verify signatures with the sender's secret; reject failures with 400 or 401.
- Use the raw request body for signature checks; re-serialised JSON may not match.
- Keep the handler fast; senders time out and retry if you are slow.
- If the unique insert fails because the event exists, return 200 anyway: it is a duplicate.
Process: Idempotent Workers
Workers pick up stored events and apply them (see our workers guide). Each handler must be safe to run more than once: check current state before acting, use database constraints, and record that the event was processed. A payment marked paid twice should stay paid once; an order shipped once should not ship again.
Ordering
Events can arrive out of order: "subscription cancelled" before "subscription renewed", for example. Compare event timestamps or version numbers with what you have stored, ignore older updates, and when in doubt fetch the current state from the sender's API rather than trusting the event alone.
Retries and Dead Letters
- Retry failed processing with exponential backoff.
- After a set number of attempts, move the event to a dead-letter state and alert.
- Provide a way to inspect and replay dead-lettered events after fixing the cause.
- Keep raw payloads for a retention period so you can reprocess them.
Staying Available
Senders retry for a limited time; long outages can lose events. Keep the receiver available during deploys with zero-downtime releases (see our zero-downtime guide), monitor it externally, and use the sender's dashboard or API to re-send events missed during an incident. For critical integrations, reconcile periodically by listing recent objects from the sender's API.
Security
- HTTPS only; signature verification on every request.
- Optional IP allow-listing if the sender publishes source ranges.
- Rate limiting to blunt floods of fake requests.
- Secrets stored in environment files, rotated when needed.
- No sensitive payload data in logs.
Monitoring
| Metric | What it tells you |
|---|---|
| Events received per source per hour | A sudden drop to zero often means the sender stopped calling you |
| Signature failures | Misconfigured secrets or attack attempts |
| Queue backlog and processing latency | Workers falling behind |
| Dead-lettered events | Bugs or unexpected payloads |
Alerts on these catch integration failures before customers do (see our monitoring guide).
Scaling
The receiver does little work, so one small server handles high volumes. Scale by adding worker processes or a worker server, partitioning queues by source or priority so payment events are never stuck behind bulk updates.
Testing
Use senders' test modes and replay tools, record real payloads (sanitised) as fixtures, and test duplicates, out-of-order delivery and failures in staging. A small local tool that replays stored events against your endpoint is invaluable.
Sizing
| Volume | Suggested setup |
|---|---|
| Up to tens of thousands of events per day | 2 vCores / 8 GB with workers on the same server |
| Hundreds of thousands per day | 4 vCores / 16 GB, or a separate worker server |
Common Mistakes
- Doing heavy work inside the request so the sender times out and retries.
- Skipping signature verification.
- Treating each delivery as unique.
- No alert when events stop arriving.
In Short
Verify, store and acknowledge quickly; process idempotently in workers with retries and dead letters; monitor arrival and processing; and keep the receiver available.
Example: Shop and Payment Webhooks
A store receives order webhooks from its storefront platform and payment webhooks from its gateway. Both land on the same small receiver, which verifies signatures, stores events with unique IDs and enqueues them. Separate queues mean payment events are processed within seconds even when a bulk catalogue update floods the order queue. A dashboard shows events received per source; when the gateway's webhooks stopped after a secret rotation, the drop to zero triggered an alert within fifteen minutes.
Next Steps
List every webhook source, add a stored-event table with unique IDs, move processing to workers, and add an alert for each source when events stop arriving. Document the setup in a short runbook covering where data lives, how integrations run, how to restore from backup and whom to contact, so the system stays dependable even when the person who configured it is unavailable or has moved on to another role. Review the setup every quarter with the people who use it, because needs change as the business grows, and small adjustments made early are far cheaper than large changes made under pressure. Before go-live, run a short pilot with a small group of real users and a realistic volume of data, collect their feedback on speed, reliability and everyday tasks, and fix what they report, because early fixes cost far less than changes made after everyone depends on the system.
ServoMix Plans for This Workload
Webhook receivers are light; a 2 vCore / 8 GB server handles large volumes when processing happens in background workers. Scale workers, not the receiver, as event volume grows.
AMD EPYC 7C13 VPS
Dedicated KVM vCores on AMD EPYC 7C13 (up to 3.70 GHz) with DDR4 ECC memory, NVMe SSD and an unmetered 1 Gbps port.
| Plan | vCores | RAM | Storage | Network | Price | Good for | Buy |
|---|---|---|---|---|---|---|---|
| SMX vPro XS (AMD EPYC) | 2 | 8 GB DDR4 ECC | 40 GB NVMe SSD | 1 Gbps, unmetered | ₹420/mo | Websites, small APIs, bots, staging and VPN servers | Order |
| SMX vPro S (AMD EPYC) | 4 | 16 GB DDR4 ECC | 80 GB NVMe SSD | 1 Gbps, unmetered | ₹560/mo | WooCommerce, Node.js/Python backends, Docker Compose stacks, CI runners | Order |
| SMX vPro M (AMD EPYC) | 8 | 32 GB DDR4 ECC | 150 GB NVMe SSD | 1 Gbps, unmetered | ₹840/mo | Production databases, high-traffic sites, multi-container apps | Order |
| SMX vPro L (AMD EPYC) | 16 | 64 GB DDR4 ECC | 250 GB NVMe SSD | 1 Gbps, unmetered | ₹1,120/mo | Large production workloads, SaaS platforms, analytics, in-memory caches | Order |
Intel Xeon Platinum 8269CY VPS
KVM VPS on Intel Xeon Platinum 8269CY (up to 3.80 GHz Turbo) with DDR4 ECC memory, NVMe SSD, full root access and an unmetered 1 Gbps port.
| Plan | vCores | RAM | Storage | Network | Price | Good for | Buy |
|---|---|---|---|---|---|---|---|
| SMX vCore XS (Intel Xeon) | 2 | 8 GB DDR4 ECC | 40 GB NVMe SSD | 1 Gbps, unmetered | ₹270/mo | Business websites, small apps, scheduled jobs and bots | Order |
| SMX vCore S (Intel Xeon) | 4 | 16 GB DDR4 ECC | 80 GB NVMe SSD | 1 Gbps, unmetered | ₹1,169/month | Business software, mid-size databases, several sites on one server | Check stock |
| SMX vCore M (Intel Xeon) | 8 | 32 GB DDR4 ECC | 150 GB NVMe SSD | 1 Gbps, unmetered | ₹2,249/month | ERP/CRM stacks, heavier databases, multiple production apps | Check stock |
| SMX vCore L (Intel Xeon) | 16 | 64 GB DDR4 ECC | 250 GB NVMe SSD | 1 Gbps, unmetered | ₹4,248/month | High-memory workloads and consolidated production servers | Check stock |
Prices are monthly in INR as listed on the ServoMix store (verified 2026-11-14). Stock and final pricing are shown on the product page at checkout.
Frequently Asked Questions
How should a webhook endpoint respond?
Why process webhooks in the background?
How do I handle duplicate webhooks?
What if webhooks arrive out of order?
What is a dead-letter queue?
How do I avoid missing webhooks during deploys?
How do I secure a webhook endpoint?
What should I monitor?
How do I test webhook handling?
What server do I need?
Related Guides
Frequently Asked Questions
How should a webhook endpoint respond?
Verify the signature, store the event, enqueue processing and return 200 within about a second.
Why process webhooks in the background?
Senders time out and retry if you are slow; background processing keeps the receiver fast and lets you retry failures.
How do I handle duplicate webhooks?
Store event IDs with a unique constraint and make processing idempotent, so repeats have no extra effect.
What if webhooks arrive out of order?
Compare timestamps or versions with stored state and fetch current state from the sender's API when in doubt.
What is a dead-letter queue?
A holding area for events that keep failing, so they can be inspected, fixed and replayed instead of lost.
How do I avoid missing webhooks during deploys?
Use zero-downtime deployments and rely on sender retries for brief gaps; re-send missed events after incidents.
How do I secure a webhook endpoint?
HTTPS, signature verification, optional IP allow-lists, rate limiting and secrets kept out of code and logs.
What should I monitor?
Events received per source, signature failures, queue backlog, processing latency and dead-lettered events.
How do I test webhook handling?
Use sender test modes and replay tools, and test duplicates, ordering and failures in staging.
What server do I need?
A 2 vCore / 8 GB server handles large volumes when processing runs in workers; add worker capacity as volume grows.
Your feedback helps us continuously improve ServoMix guides.
Know someone who may find this guide useful?
