What Are Webhooks and How Do They Work?
Understanding what are webhooks allows developers to build reliable event-driven integrations. This guide clarifies idempotency to prevent duplicate data.
Covers automation pricing models: cost-per-run math, where per-task billing breaks at scale, and pricing tiers that hide true costs.
ContributorSeptember 29, 202613 min read
This article was researched and fact-checked by an advanced research system.
WHAT IS MISSING: The article mentions "idempotency keys" and "idempotency" as a solution for duplicate events and retries, but never explains what idempotency is or how it works.
A reader who doesn't know the term will not understand how to actually solve the problem of duplicate data.
Add a brief explanation of idempotency (ensuring the same operation can be performed multiple times with the same result as a single execution) in the "Handling the 200 OK acknowledgement" or "Stripe" section.
THE ARTICLE'S ARGUMENT, which the addition must serve rather than wander from: Modern webhooks are high-stakes infrastructure that require deep architectural transparency (rather than opaque managed services) to ensure security and reliability.
Webhooks: automated push notifications for server-to-server communication
When a specific event occurs, a webhook functions as a reverse API, transmitting data to a predefined listener URL. This mechanism eliminates the need for periodic manual requests.
While a standard API requires your system to ask for an update, a webhook allows the source system to initiate the conversation. This allows downstream processes like those managed via Activepieces to receive data in real-time.
The difference between polling and webhooks
Polling requires a client to make repeated requests to a server to check for new information. By contrast, webhooks allow the server to push a single notification only when data is actually available.
In a polling model, a client might ask "Any new data?" 1,000 times an hour and receive "No" for 999 of them, wasting CPU cycles and network bandwidth.
The webhook model sends a single packet only when a state change occurs, reducing infrastructure overhead and ensuring immediate action.
The three components of a webhook delivery
A functional webhook requires a source to trigger the event, a payload containing the data, and a listener URL to receive the packet. The source, such as a payment gateway, monitors for specific actions like a completed transaction.

Formatted usually as JSON, the payload carries the details of that transaction. Finally, the listener is the endpoint on your server that must acknowledge receipt within strict time limits.
Why webhook push beats polling architectures
Modern distributed systems favor push architectures for superior resource efficiency. However, they impose rigorous performance requirements on the receiver. If your listener is slow, the source will drop the connection.
15 seconds is the maximum timeout allowed by the communication provider Twilio, according to Hookdeck. This means your logic must execute or queue the task almost instantly to avoid delivery failure.
Hookdeck reports that the payment processor Adyen is even more restrictive with a 10-second timeout. This forces developers to move heavy processing to background workers to prevent data loss.
The tightest constraint comes from the incident response platform PagerDuty, which permits only 5 seconds for a response, leaving almost no margin for complex diagnostic processing, so automated troubleshooting must be extremely lightweight.
Any delay in your network stack will result in a missed critical alert.
Everything below works on Activepieces' free plan. Start without code or a credit card.
The technical lifecycle of a webhook event delivery
The technical handshake involves an event trigger, a payload delivery via HTTP POST, and a specific status code response to confirm receipt.
- Event occurs in Source App
- Source App constructs JSON payload
- Source App sends HTTP POST to Listener URL
- Listener returns 2xx Status Code to acknowledge
This flow establishes a strict contract where the burden of delivery lies with the sender and the burden of processing lies with the receiver.
Registering a webhook endpoint URL
A webhook starts with the destination address, which must be a publicly accessible URL. In the configuration dashboard of a service like Stripe, the user enters this URL to create a permanent subscription to specific event types.

Providing an incorrect or unauthenticated URL results in a failed handshake, and the source app will stop sending data to protect against leakage.
Webhook payload structure and format
The payload is a data packet typically formatted as a JSON object within the body of an HTTP POST request. This structure includes a unique identifier for the event, a timestamp, and the specific data changed.

Standardizing on JSON means the receiving server can use native parsers, reducing the custom code required to handle different event types.
Acknowledging webhook delivery with 200 OK
A successful delivery concludes when the listener returns a 2xx status code. If the listener returns a 500 error or a 404 not found, the source app will usually initiate retry logic, which can lead to duplicate events.

Prompt acknowledgement is the only mechanism the sender has to clear the event from its outbound queue.
Ensuring consistent results through idempotency
To handle these inevitable retries without corrupting data, the receiver must be idempotent. Idempotency ensures that performing the same operation multiple times with the same input yields the exact same result as the initial execution.
In practice, this means your server checks if it has already processed a specific event ID before executing any state-changing logic.
Idempotency ensures that performing the same operation multiple times with the same input yields the exact same result as the initial execution.
If a network hiccup causes the sender to transmit the same payment notification twice, an idempotent listener recognizes the duplicate and ignores the second request. This architectural safeguard prevents critical errors like double-billing a customer or incrementing inventory counts incorrectly.
Without this logic, the retry mechanisms designed for reliability actually become a source of system instability.
Security and stability risks in unmanaged webhook listeners
Unmanaged listeners expose internal systems to denial-of-service attacks and data corruption. Without a gateway to buffer and verify incoming traffic, your application logic is directly vulnerable to every malformed or malicious packet hitting the public endpoint.
Verifying webhook payloads with HMAC signatures
Authenticating the sender via Hash-based Message Authentication Code (HMAC) ensures that the payload wasn't forged. If a receiver skips this step, it treats every POST request as a trusted command.
Implementing this requires the listener to compute a SHA-256 hash using a shared secret and compare it to the signature header provided by the sender. A mismatch results in an immediate 401 Unauthorized response, so the application never wastes CPU cycles processing fraudulent data.
If a receiver skips this step, it treats every POST request as a trusted command.
Preventing the thundering herd effect
A sudden burst of events can overwhelm downstream databases. When a service like GitHub pushes thousands of updates simultaneously, an unthrottled listener will attempt to spawn a concurrent process for each, exhausting the connection pool. To prevent this, consider:
Queueing: Moving payloads to a message broker decouples ingestion from processing. Rate Limiting: Rejecting traffic exceeding a defined threshold protects the primary database. Circuit Breaking: Disabling the integration automatically when error rates spike prevents a total system collapse.
The danger of recursive webhook loops
When a webhook action triggers a change that generates a new event for the same listener, a recursive loop occurs.
If an automation in a CRM updates a lead record, and that update fires a webhook that tells the CRM to update the lead again, the system enters an infinite execution cycle.
Developers must implement idempotency keys or origin tagging to identify and drop redundant events before they re-enter the workflow.
Easier to see it running than to read about it: set it up free, no card.
Three ways to build a webhook receiving infrastructure
Choosing a webhook receiver architecture requires balancing engineering hours against the long-term expense of operational failures.
| Architecture | Latency | Maintenance Effort | Native Retry Logic |
|---|---|---|---|
| Custom Node.js Listener | Lowest | High | None |
| Managed Middleware | Moderate | Low | Configurable |
| Cloud Queues (AWS SQS) | Low | Moderate | Built-in |

Choosing a webhook receiver architecture
A custom Node.js listener provides the most direct path for incoming data, minimizing connection time. However, this approach places the entire burden of state management on the developer.
Managed middleware refers to third-party platforms that provide a pre-built ingestion layer. Tools like Zapier or Activepieces function as this middle layer, offering a stable URL that stays online even when your primary application is down.
These services automatically manage the initial HTTP handshake and store the payload until your internal logic is ready.
Integrating a dedicated queuing service like AWS SQS decouples reception from processing. This ensures that even if your backend workers are overwhelmed, the system persists the incoming event in a durable buffer.
Developers utilizing GPT-6 Sol can automate the generation of these infrastructure-as-code templates to ensure consistent security headers across all receiving endpoints. This automation reduces the likelihood of misconfiguring the dead-letter queues that catch failed deliveries.
Standard webhook implementations in leading SaaS platforms
Modern webhook architectures across leading SaaS platforms enforce strict operational boundaries to prevent a single runaway integration from degrading the entire API gateway.
| Platform | Webhook Limit Metric | Consequence for Architecture |
|---|---|---|
| GitHub | 25MB payload | Large diffs require secondary API fetches |
| Asana | 10,000 webhooks per token | Massive multi-workspace syncs are feasible |
| Atlassian | 100 webhooks per tenant | Complex Jira workflows must consolidate events |
Asana permits up to 10,000 webhook URLs per personal access token according to Atlassian. In contrast, Jira limits apps to 100 webhook URLs per tenant. An enterprise-grade integration must use broad JQL filters rather than specific triggers to avoid hitting the cap.
Stripe: The gold standard for retry logic
Stripe provides a robust retry schedule that spans three days to ensure temporary receiver downtime doesn't result in permanent data loss. Hookdeck indicates that if your endpoint fails to return a 2xx status code, the platform attempts redelivery with exponential backoff.
This persistence means your infrastructure must be idempotent to avoid duplicate fulfillment.
GitHub: Managing high-frequency repository events
GitHub enforces a 25MB payload limit on all webhook deliveries, which means developers must filter their data streams to avoid exceeding the transmission threshold. When a large repository push exceeds this size, the payload is truncated.
Developers must program the listener to detect the missing data and initiate a manual fetch via the REST API. GitHub also uses a X-GitHub-Delivery GUID to help you deduplicate events that arrive out of order.
Shopify: Dealing with massive bulk operations via webhooks
Shopify utilizes a mandatory versioning system where webhook payloads are tied to specific API releases.
This forces developers to update their logic every 12 months, preventing "silent breakage" where a change in a JSON structure crashes a legacy script, ensuring that integration stability is maintained through proactive maintenance.
For high-volume merchants, Shopify supports Amazon EventBridge as a delivery target to bypass public HTTP endpoints entirely.
How Activepieces manages webhook reliability at scale
Activepieces provides a managed execution environment that abstracts the listener layer, allowing teams to ingest and route webhook data through a visual logic engine without maintaining custom server boilerplate.
The platform handles the plumbing of asynchronous processing through a structured workflow approach:
Trigger Decoupling: The incoming HTTP request is acknowledged immediately, so the source platform doesn't time out.
Payload Transformation: Data is normalized within the flow, so downstream services receive only the specific fields they require.
Step-Level Retries: If a specific action fails, the system retries only that node rather than re-running the entire webhook delivery.
Integrating with high-reasoning models
This architectural transparency is critical when integrating with high-reasoning models like Gemini 3.8 Flash or GPT-6 Sol. Instead of piping raw, unfiltered JSON into an expensive context window, Activepieces allows for pre-processing steps that validate the payload against a schema.
This prevents wasted compute costs on malformed or irrelevant events.
The Monday morning checklist for deploying new webhooks
Reliable webhook deployment requires a standardized sequence of verification steps to prevent silent data loss. To maintain infrastructure integrity, every new integration must pass through a specific validation gauntlet:
- Generate a secret token
- Test endpoint with Webhook.site
- Implement HMAC signature verification
- Configure a Dead Letter Queue (DLQ) for retries
Verifying webhook authenticity with cryptographic proof
Following this checklist ensures that the receiving server can cryptographically prove an incoming request originated from a trusted source. Once the signature is verified, the Dead Letter Queue acts as the final safety net.
If your internal processing logic fails, the event is shunted to a secondary storage layer rather than being deleted.
Frequently asked questions about webhooks
How do I debug a webhook that isn't firing?
Debugging a failed webhook requires verifying the egress at the source and the ingress at the destination to identify where the silent drop occurred.
Because managed services often mask internal routing logs, you must use an interceptor tool to confirm if the payload ever reached the public internet.
If the source system shows a successful dispatch but your server remains silent, the issue is likely a firewall rejection or an expired SSL certificate on your endpoint.
Are webhooks more secure than APIs?
Webhooks aren't inherently more secure than APIs. They reverse the traditional trust relationship by requiring your server to accept unsolicited inbound traffic.
While a standard API call puts the client in control of the timing, a webhook forces the server to be permanently reachable.
This increases the surface area for denial-of-service attacks. To mitigate this risk, you must implement cryptographic signature verification so that your application can immediately discard any payload not signed by the legitimate sender’s private key.
What is a dead-letter office in webhook architecture?
A dead-letter office is a dedicated storage queue for payloads that failed to process after the maximum number of retry attempts.
Without this secondary storage, a temporary database timeout or a code bug results in the permanent loss of the event data.
By isolating these failures, you allow engineers to inspect the specific malformed JSON or logic error and replay the event manually once the underlying infrastructure issue is resolved.
Can webhooks be used for real-time data streaming?
Designed for discrete event notifications rather than continuous data streams, webhooks are inefficient for high-frequency updates.
Because every webhook involves the overhead of a new HTTP handshake, attempting to stream thousands of events per second will saturate your connection pool and increase latency.
For use cases requiring constant synchronization, a persistent WebSocket connection is the appropriate choice as it maintains a single open channel for bidirectional data flow.
