Updated
Fanning Out Webhooks Without Tears
An internal routing service had one job: take an incoming WhatsApp event and forward it to every app that subscribed to it. The naive version — loop over subscribers and POST synchronously — works in a demo and falls over in production.
The slow-consumer problem
If you forward synchronously, the slowest subscriber sets the pace for everyone. One app having a bad day means delayed delivery for all of them, and eventually a backlog that takes the router down too.
Decouple with a queue
Accept the event, persist it, return 200 fast. A separate worker delivers to each subscriber independently, with retries and backoff per target. A failing subscriber only hurts its own queue.
- Acknowledge fast, deliver asynchronously.
- Isolate failure per subscriber — one bad target should not block the rest.
- Make delivery idempotent so retries are safe.
Context from my work
At Erasys Consulting, I designed webhook routing middleware for partner applications registering as OAuth2-authenticated listeners. My contribution covered event routing and automatic retries to recover failed deliveries. The operational concern was keeping integrations working when receiving applications had different response times or availability.
Decisions and tradeoffs
Forwarding an event within the incoming request is simpler. A queue and separate workers add components to operate, but allow delivery to each subscriber to be handled independently. The earlier section describes that pattern; the following points are considerations when implementing it.
Retries need a limit, and final failures need to be visible to operators. Consumers also need to recognize events they have already processed, because redelivery can carry the same event. A successful HTTP response from the router should mean the event was accepted for processing, rather than that every subscriber finished its work.
The result described in my experience is routing middleware with retry-based delivery recovery. Retries should not be read as a guarantee against data loss under every failure condition.
See my work experience, or read the voucher claims and locking notes.