Webhooks are a cornerstone of modern SaaS integrations, but every provider gives you a limited window to acknowledge an incoming event. When that window closes, the payload is lost and your workflow stalls.
Webhook timeout refers to the maximum time a webhook sender will wait for a 2xx HTTP response before discarding the request.
Why Webhook Timeouts Vary So Much
Different platforms set their own limits based on infrastructure, user‑experience expectations, and security policies. For example, LINE enforces a strict 2‑second limit, while SmartHR allows up to 60 seconds. This disparity means a single integration codebase cannot rely on a one‑size‑fits‑all timeout assumption.
The Acknowledge‑First Pattern Explained
The pattern that works universally consists of four steps:
- Verify the request signature or token to ensure authenticity.
- Store the raw payload in a durable queue or database.
- Return an immediate 2xx response (usually 200 OK) to the sender.
- Process the event asynchronously, using background workers, serverless functions, or message queues.
By separating acknowledgement from processing, you guarantee compliance with any timeout limit while keeping your business logic decoupled and resilient.
Implementing the Pattern in Your Stack
Below is a practical checklist for developers building webhook endpoints:
- Expose a HTTPS endpoint that validates HMAC signatures or JWT tokens.
- Use a lightweight write‑ahead store (e.g., Redis, DynamoDB, or a relational table) to persist the payload instantly.
- Send a plain 200 OK response as soon as the write succeeds.
- Trigger an asynchronous worker (Celery, Sidekiq, AWS Lambda, Google Cloud Functions) to handle business logic.
Because the heavy lifting happens after the 2xx response, the endpoint’s execution time stays well below even the strictest 2‑second limit.
Handling Edge Cases and Retries
Even with the acknowledge‑first pattern, you must plan for failures during asynchronous processing:
- Mark each stored event with a processing status (pending, success, failed).
- Implement exponential back‑off retries for transient errors.
- Dead‑letter queues capture events that repeatedly fail, enabling manual inspection.
These safeguards ensure that a temporary outage in downstream services does not cause data loss.
Monitoring and Observability
Visibility into webhook health is essential. Consider the following metrics:
- Rate of incoming webhook requests per provider.
- Average time from receipt to 2xx acknowledgement (should be < 100 ms).
- Success vs. failure counts of asynchronous workers.
Dashboards and alerting rules help you react before a timeout limit becomes a business‑impacting issue.
Frequently Asked Questions
What happens if I return a non‑2xx status?
The sender treats it as a failure and may retry according to its own schedule, potentially flooding your endpoint.
Can I skip storing the payload and process inline?
Only if you are certain the processing will always finish within the provider’s timeout, which is risky given the wide range of limits.
Is the acknowledge‑first pattern compatible with serverless platforms?
Yes. Serverless functions excel at quick acknowledgement and can dispatch further work to queues or other functions.
How do I verify signatures efficiently?
Compute the HMAC using the shared secret and compare it with the header value in constant time to avoid timing attacks.
Do I need separate endpoints for each provider?
Not necessarily. A single endpoint can handle multiple providers by branching logic based on request headers or payload structure.
Neptune Infotech can help you design and implement robust webhook architectures that respect provider limits and scale with your business needs.