Skip to content
Workflow Design

What Is a Webhook? A Guide for Workflow Planning

Understand webhooks as event notifications, including payloads, verification, duplicate delivery, and destination checks.

An event is a notification. Receipt and completion are different states.
Original explanatory diagram by OptimaFlow AI; not a product screenshot.

A webhook is an HTTP POST one system sends another the moment something happens — no polling, no waiting. The sender calls your endpoint, you verify the request, return a 2xx quickly, and do the slow work afterwards. The hard part is not receiving the event: it is surviving duplicates, slow handlers and failed deliveries without losing a payment or sending an email twice.

Identify the event and payload

An event might be a submitted form, a changed record, or a completed task. The payload is the information sent with that notification. Read the provider’s current documentation to learn the event name, fields, and delivery behavior.

For a fictional enquiry, the payload could include an enquiry ID, submission time, and message text. A field may be missing or have a different type than expected. Write a small input contract before mapping it directly to the destination.

Verify and validate before processing

Use the provider’s supported authentication or signature verification method. Keep secrets in the intended credential mechanism rather than in public instructions. An endpoint receiving a request does not by itself establish who sent it.

Check required fields and allowed event types. Route unexpected input to a controlled failure path. If the request contains private data, minimize logging and follow the relevant organizational rules. AI interpretation belongs after predictable validation, not in place of it.

Acknowledge and complete are different

The sender may treat a response as acknowledgment that the event was received. The downstream task may still be queued or fail later. Define how the workflow records received, processing, completed, and needs-review states.

Do not tell a customer that an action completed merely because the webhook arrived. Check the destination result. For long work, a queue can separate quick receipt from processing, depending on the platform’s supported design.

Plan delivery edge cases

Some services retry notifications, deliver events out of order, or delay delivery. Check the specific provider’s behavior. Use stable identifiers to prevent duplicate creates and compare version or event time where the task requires ordering.

Consider what happens when a notification never arrives. A reconciliation check may compare source records with completed destination records. The appropriate check depends on the importance of the task and the services involved.

Test the complete path

Use a provider-supported test event or fictional payload in an authorized environment. Confirm reception, validation, mapping, action, and logging. Then test a missing field and repeated event. A successful endpoint response is only one part of the evidence.

Keep the payload example and recovery steps in the workflow documentation. Read our repeat-action guide before connecting a webhook to automatic record creation.

Example: one event delivered twice

A form service sends the same enquiry event twice after it does not receive the expected acknowledgment. Both notifications carry the same source ID. The receiving workflow recognizes that reference and follows its repeat policy rather than creating two enquiries.

Check the service’s documented behavior before designing this test. Some providers have specific acknowledgment time limits and retry schedules. Keep those details with the workflow’s configuration rather than assuming every webhook service behaves alike.

A completion assumption to avoid

An HTTP success response can acknowledge receipt without proving that the downstream record was created. Check the workflow’s completion state and destination result separately.

The webhook lifecycle in five steps

StepWhat happens
1. RegisterYou give the provider a public HTTPS endpoint and pick the event types you care about
2. EventSomething happens; the provider queues the event so delivery never blocks its own request
3. DeliverA worker sends an HTTP POST with a JSON body, an event ID, a timestamp and an HMAC signature in the headers
4. Verify and respondYour endpoint checks the signature, returns a 2xx within 5 to 30 seconds, and processes the event asynchronously
5. RetryOn a 5xx or a timeout, the provider retries with exponential backoff over 24 to 72 hours, then dead-letters the event

What each status code tells the sender

Your responseWhat the sender readsRetry?
2xxDelivery succeededNo
4xx, except 429Something is wrong with the request — bad signature, malformed payloadNo — retrying will not fix it
429, rate limitedSlow downYes — honour the Retry-After header
5xx or timeoutA temporary failure on your sideYes, with backoff

Duplicates are normal — plan for them

Every provider retries failed deliveries, and most delivery is at-least-once, so the same event will arrive more than once — sometimes hours apart. Stripe retries up to 36 times over 72 hours with exponential backoff. Your handler has to be idempotent: processing the same event twice must produce the same end state as processing it once, not a duplicated order or a double-sent email. The standard fix is to store the unique event ID the provider sends, check whether you have already processed it before doing any real work, and record it once you have. Keep the deduplication store at least as long as the provider’s retry window — a one-day cache against a three-day retry schedule will happily reprocess a stale retry as brand new. See how duplicate workflow actions are handled and the retry policy on your side in safe workflow retries.

Acknowledge fast, process slow

Return a 2xx in under a few seconds and push the slow work — database writes, downstream API calls, emails — onto a queue rather than doing it inside the handler. The timeouts are short: Stripe times out at 5 seconds, GitHub at 10, Shopify at 5. If your handler does real work before responding, you will eventually breach the timeout, the sender will assume failure, and it will retry. Retries on a slow handler stack up like a queue full of bricks. The fix is always the same: drop the event on a queue and return 200 OK immediately. Verify the HMAC signature from the request header against the raw body using your shared secret, and reject anything outside a short timestamp tolerance window to block replay attacks using an intercepted-but-valid old payload. Webhooks are one trigger inside a larger flow — see what an AI workflow is — and when deliveries keep failing, work through the automation troubleshooting checklist.

Frequently asked questions

Is a webhook the same as an API?

A webhook commonly uses an HTTP request to report an event. An API can support many other request-and-response operations. Check the service’s specific implementation.

Does a webhook always arrive instantly?

No. Delivery timing and retry behavior depend on the service. Build the process around documented behavior and observed tests.

How long do providers retry a failed webhook?

Typically 24 to 72 hours with exponential backoff. Stripe retries up to 36 times over 72 hours; GitHub retries a handful of times and then marks the delivery as failed in its dashboard. After the window closes, the event is dead-lettered — so monitor the dead-letter list, not just the live deliveries.

What is a webhook signature?

An HMAC-SHA256 hash of the raw request body, computed with a secret shared between you and the sender and sent in a header. Your endpoint recomputes the hash and compares it; if it does not match, the request did not come from the sender. Verify the signature on every request, before processing anything.

Why did I receive the same webhook twice?

Because retries and at-least-once delivery are the norm, not a bug. A slow response, a timeout or a network blip makes the sender retry, and the same event ID arrives again. Deduplicate on the event ID: if you have already processed it, return 200 immediately without redoing the work.

Webhook or polling — which should I use?

Webhooks when you need real-time notification and the provider offers them: the provider calls you the moment something happens, with no wasted requests. Polling when the provider has no webhooks, or when you need to re-check state on your own schedule. The break-even sits around one poll every 5 minutes — poll more often than that and a webhook is cheaper.

Was this guide helpful?

Your selection stays on this page. To send feedback to the publication, use our contact form.

About this publication

From OptimaFlow AI

Practical guides to AI, automation, and better everyday workflows. We use illustrative examples and original diagrams, with AI-assisted writing and illustrations.

Read our editorial approach →About OptimaFlow AI
What Is a Webhook? A Guide for Workflow Planning