Webhook Notification Setup Guide for DevOps Teams
At 3 a.m., an SRE gets paged for an incident that already resolved. The monitoring platform sent the same alert twice, the incident workflow created duplicate handoffs, and the on-call engineer now has to determine whether the problem was the monitor, the network, the receiver, or the retry logic. The webhook notification delivered data, but the integration still failed operationally.
That distinction matters. A webhook endpoint isn't just an HTTP route that accepts JSON. It's a delivery boundary with authentication, acknowledgement, retry behavior, deduplication, queues, observability, and recovery procedures. Teams that implement only the happy path eventually discover that a delayed request, a provider timeout, a malformed payload, or a duplicated event can create a larger incident than the original alert.
Table of Contents
- What a Webhook Notification Actually Does
- Creating Your First Webhook Endpoint
- Verifying Webhook Signatures the Right Way
- Handling Retries and Status Codes Correctly
- Building Idempotent Receivers That Survive Duplicates
- Testing Webhooks Locally and Wiring Up Real Alerts
- Operational Best Practices and Production Checklist
What a Webhook Notification Actually Does
A webhook notification is an HTTP callback that a remote system sends to a URL selected by the receiving team. An event occurs in the source platform, the platform builds a payload, and it sends that payload, usually as an HTTP POST, to the receiver's endpoint. The receiver validates the request, records enough information to investigate it, and returns an HTTP response that tells the sender whether delivery succeeded.
The basic lifecycle is straightforward:
- A trigger event occurs, such as an alert firing, an incident resolving, or a host changing state.
- The source system creates a payload containing event metadata and relevant resource details.
- The source sends an HTTP request to the configured endpoint.
- The endpoint authenticates and accepts the request.
- The receiver records or queues the event.
- The source interprets the response and may retry when the delivery fails.
The endpoint is the public URL receiving the request. The payload is the request body. A delivery attempt is one request made by the provider, while a retry is a later attempt after a failed or ambiguous response. A dead-letter event is a delivery that exhausted the provider's retry policy or was deliberately isolated for manual recovery.
Push delivery versus polling and queues
Polling requires the consumer to ask the source system whether anything changed. That approach can work for slow-moving data, but it introduces delay, repeated requests, and awkward decisions about polling frequency. A webhook pushes the event when the source detects it, which makes the model useful for alert routing, incident automation, deployment triggers, and other workflows where downstream action should begin quickly.
A webhook isn't the same as a message queue. The sender normally makes an HTTP request directly to the receiver, and the receiver must respond over that request path. A queue provides durable buffering and consumer control, while a webhook often needs a queue behind it to gain those properties. The practical architecture is therefore frequently webhook at the edge, queue in the middle, worker downstream.
Webhook contracts vary by provider: authentication, event identity, timeout and retry behavior must come from that provider’s documentation. For broader API engineering context, TekRecruiter API hiring insights can help teams connect integration design with the skills needed to operate it.
A monitoring team evaluating alert delivery should also distinguish a webhook notification from a complete alerting workflow. The webhook is the transport. Escalation policy, suppression, ticket creation, Slack routing, and human acknowledgement belong to the systems connected after delivery. A practical overview of that wider model appears in real-time alerting guidance.
Creating Your First Webhook Endpoint
A receiver should validate the HTTP method, content type, size and authentication before treating JSON as a trusted event. Persist a valid event before acknowledging it, then process it asynchronously. Logging a body and immediately returning 200 is only a transport demonstration: it can silently lose work and should not be presented as a production receiver.
Use this intake order:
- Enforce HTTPS and a request-size limit at the edge and application.
- Read the exact raw bytes and validate the sender’s documented authentication scheme.
- Parse JSON and validate the event type, identifier and required fields.
- Commit a durable inbox record with a provider-scoped unique key.
- Return the provider’s expected successful response; let workers process the inbox.
The payload below and the later HMAC function are custom educational examples, not a Fivenines, Stripe or GitHub wire contract. Use the real sender’s documentation or SDK for those services.
Read the fields that support operations
A realistic monitoring payload might look like this:
{
"event_type": "incident.created",
"timestamp": "2026-08-17T03:12:44Z",
"severity": "critical",
"monitor_id": "monitor-7f2a",
"event_id": "7c0f4d25-2b4a-4fb4-8df6-2ef7d9c1c4a8",
"status": "failing",
"message": "HTTPS check failed",
"resource": {
"name": "checkout-api",
"environment": "production"
}
}
The event ID is the most important field for deduplication and investigation. The event type controls routing, the timestamp helps reconstruct ordering and latency, severity affects escalation, and the monitor or resource ID lets responders locate the originating object. Free-form messages are useful to humans, but automation should prefer stable identifiers and enumerated event types.
Headers carry different signals from the body. Content-Type describes serialization, User-Agent describes the claimed client but is forgeable, and X-Signature or a provider-specific equivalent supports authentication. Custom headers may contain delivery IDs, timestamps, tenant context, or attempt metadata. Log only the approved correlation metadata. Do not routinely log signature values, authorization headers, ping URLs or full payloads; signatures and payloads together may enable replay.
For local development, a tunnel such as ngrok or Cloudflare Tunnel can expose the local route to the public internet. The provider sends a real request to the tunnel, and the tunnel forwards it to the local process. A request inspector such as webhook.site may help with synthetic test payloads. Do not send production credentials or customer payloads to a third-party inspector without authorization. Production endpoints should use HTTPS, should never place secrets in query parameters, and can use provider-published delivery ranges for network filtering where that information is available. Teams maintaining Linux hosts should also understand certificate handling through certificates in Linux, since certificate failures can look like provider delivery failures.

Verifying Webhook Signatures the Right Way
An internet-facing webhook endpoint must assume that anyone can send it a request. A valid-looking JSON body doesn't prove that the monitoring provider created it. Signature verification gives the receiver a way to establish that the sender knew a shared secret.
Many providers use HMAC, but header names, digest encoding and signed material differ. Some use other authentication schemes. Do not invent an X-Signature verification rule for a sender that does not implement it.
Preserve the raw body
This standard-library Python function demonstrates a custom contract: lowercase hex HMAC-SHA256 of timestamp + "." + raw_body, a decimal Unix timestamp and a five-minute delivery tolerance. Both sender and receiver must implement this exact contract. It verifies before parsing and performs no network or business action:
import hashlib
import hmac
import json
import re
def verify_event(raw, timestamp, signature, secret, now):
if not secret:
raise ValueError("Missing configured secret")
if not isinstance(raw, bytes) or len(raw) > 262144:
raise ValueError("Invalid body size")
if not isinstance(timestamp, str) or not re.fullmatch(r"[0-9]{1,12}", timestamp):
raise ValueError("Invalid timestamp")
if abs(now - int(timestamp)) > 300:
raise ValueError("Stale or future delivery")
if not isinstance(signature, str) or not re.fullmatch(r"[0-9a-f]{64}", signature):
raise ValueError("Invalid signature format")
signed = timestamp.encode("ascii") + b"." + raw
expected = hmac.new(secret, signed, hashlib.sha256).hexdigest()
if not hmac.compare_digest(expected, signature):
raise ValueError("Signature mismatch")
event = json.loads(raw.decode("utf-8"))
if not isinstance(event, dict):
raise ValueError("Expected an object")
if not isinstance(event.get("event_id"), str) or not 1 <= len(event["event_id"]) <= 200:
raise ValueError("Invalid event ID")
if event.get("event_type") not in ("incident.created", "incident.resolved"):
raise ValueError("Unsupported event type")
return event
The HTTP adapter must handle validation errors deliberately, enforce limits before reading an unbounded body, and use a synchronized clock. JSON may be cached by a framework, but re-serializing parsed JSON before checking the signature can change the signed bytes. Authentication does not remove the need for durable duplicate handling.

Add freshness checks and useful failure logs
A valid signed request can be replayed. Providers that include a timestamp allow the receiver to reject old requests, reducing replay risk. The receiver should compare the signed timestamp with its current clock, enforce an accepted freshness window appropriate to the provider's documentation, and include the timestamp in the signed material when the provider specifies that format.
Failed verification logs should support investigation without becoming a data leak. Useful fields include the endpoint name, provider identifier, request timestamp, delivery identifier, source user agent, received signature scheme, and rejection reason. The raw secret, full authorization header, and unnecessary personal or payment data should never enter ordinary application logs.
Security teams can use the following video as a supplementary visual explanation of signature validation:
Handling Retries and Status Codes Correctly
HTTP status communicates what happened to a delivery; it does not impose a universal retry contract on webhook senders. A 408, 429 or 5xx may be recoverable, but only the sender’s documented behavior tells you whether another attempt will occur.
Return success only after durable acceptance, before slow business work. GitHub requires a 2xx response within 10 seconds; its failed deliveries are not automatically redelivered. Stripe documents automatic retries and possible duplicate or out-of-order events. Configure timeout, replay and reconciliation from the actual sender contract, not a generic 10–15-second rule.
Operational rule: A webhook handler should receive, authenticate, persist, and acknowledge. It shouldn't wait for ticket creation, database fan-out, or notification delivery inside the provider's request.
Use the response to express intent
A failure response should make the state clear without exposing sensitive diagnostics. Suggested receiver behavior is:
| Response | What the receiver is saying | What to do next |
|---|---|---|
| 2xx | Durably accepted, including a duplicate already stored | Process the inbox; do not equate acceptance with completed work |
| 400 | Payload invalid for this contract | Investigate schema and event version |
| 401/403 | Authentication rejected | Check secret rotation and signing scheme |
| 408/429 | Timed out or capacity constrained | Sender may retry; use supported backoff/Retry-After behavior |
| 410 | Endpoint intentionally retired | Update or disable the subscription explicitly |
| 5xx | Acceptance failed or is uncertain | Inspect the inbox before replay; follow the sender policy |
A receiver sends Retry-After when appropriate; it cannot force the sender to honor it. Returning 410 also does not guarantee the sender disables a subscription automatically.
Providers differ substantially in retry duration, backoff, jitter, and exhaustion behavior. Some delivery attempts can continue from seconds into many hours, so a receiver that was unavailable briefly may receive late events after recovery. A local inbox protects events already received; it cannot recover a request that never arrived. A sender with no automatic retry needs delivery-history replay or source-state reconciliation where supported.
Large payloads introduce another failure mode. A receiver should enforce a documented body limit and return a deliberate response rather than crashing or consuming unbounded memory. Guidance on request entity too large errors helps teams handle that boundary explicitly.
Building Idempotent Receivers That Survive Duplicates
Webhook delivery can be duplicated or lost. Some senders provide at-least-once retry behavior within a bounded window; others do not automatically retry. None of that makes downstream side effects exactly once. The sender may retry because it saw a timeout even though the receiver completed the work, or because a network interruption obscured the original response. The same event can therefore arrive multiple times, and the receiver must make repeated delivery safe.
Consider a refund event. A naive handler receives the event, calls the payment API to issue the refund, and returns success. If the payment API call succeeds but the webhook response is lost, the sender retries. The second handler invocation calls the refund operation again. Depending on the payment system, that can create a duplicate refund, a rejected operation, or a reconciliation problem.
The receiver should use the provider's unique event ID as a durable idempotency key.
Choose the storage boundary carefully
Avoid a two-step “Redis SET NX, then enqueue” design unless both operations share an atomic durable boundary. If the process dies after setting the duplicate marker but before publishing to the queue, a retry can be acknowledged as a duplicate while no worker ever receives the event.
A database inbox can be both the deduplication store and the work queue. For example, in PostgreSQL:
CREATE TABLE webhook_inbox (
provider text NOT NULL,
event_id text NOT NULL,
payload jsonb NOT NULL,
state text NOT NULL DEFAULT 'pending',
received_at timestamptz NOT NULL DEFAULT now(),
PRIMARY KEY (provider, event_id)
);
-- Bind parameters; do not concatenate untrusted values into SQL.
INSERT INTO webhook_inbox (provider, event_id, payload)
VALUES ($1, $2, $3::jsonb)
ON CONFLICT (provider, event_id) DO NOTHING;
Commit before returning success. Workers must claim pending rows safely, record attempts, and recover abandoned claims. If a separate broker is needed, publish through a transactional outbox instead of assuming a database write and a broker publish succeed together.
A unique event key prevents duplicate inbox entries, not duplicate external side effects. A worker can crash after creating a ticket but before marking the row complete. Pass a stable idempotency key to the downstream API when supported; otherwise design reconciliation before permitting retries. Keep deduplication records for the sender’s retry and permitted replay horizon, not an arbitrary short TTL.
Idempotency also belongs inside downstream operations. Queue consumers should carry the event ID, database writes should use unique constraints where appropriate, and external APIs should receive their own idempotency key when supported. A receiver that deduplicates only at the HTTP edge can still repeat work when a queue redelivers a message.
Testing Webhooks Locally and Wiring Up Real Alerts
A local receiver becomes useful only when it sees realistic requests. Start the application, expose its route through ngrok or Cloudflare Tunnel, and configure a development subscription to target the tunnel URL. Use webhook.site as a separate inspection point when the provider's payload shape or headers aren't clear.
The first isolated test should verify transport without executing business actions. Send a request with curl or Postman and confirm the method, path, event ID and response status using synthetic data. Keep raw bytes for signature verification in memory; do not turn unrestricted request logging on in production. Then test malformed JSON, missing signatures, stale timestamps, oversized bodies, duplicate event IDs, and downstream queue failure.
Replay real deliveries safely
A captured delivery is more valuable than a hand-written sample. Export a production payload only after redacting secrets, tokens, personal information, and payment details. Redacting the body invalidates its original signature. Re-sign with a staging-only secret under the test contract, or use the provider’s supported test/redelivery tool. Never disable production signature validation to make a replay pass. Keep a stable test event ID to exercise duplicate handling.
A useful replay sequence includes:
- First delivery: Confirm signature verification, schema validation, persistence, and queue publication.
- Second delivery: Reuse the same event ID and verify that the receiver doesn't repeat the side effect.
- Delayed delivery: Change the timing metadata where the provider permits it and test freshness handling.
- Failure response: Force a worker or downstream dependency to fail, then verify queue retry and dead-letter behavior.
- Recovery: Replay the isolated event through an approved tool and confirm that operators can trace the outcome.
Postman works well for authored requests and collections. Teams looking for alternative request inspection and replay workflows can compare tools through alternatives to Postman.
Connect monitoring events to actions
A monitoring integration should define which event types create work. Typical choices include incident creation, incident resolution, and host or check status changes. The receiver can route critical events to an incident-ticket endpoint, while a relay can transform the same event into a Slack notification.
The configuration should separate notification transport from business actions. A relay can accept the authenticated monitoring event, normalize fields such as severity and monitor name, and then send a concise Slack message. A custom automation endpoint can create an incident ticket with the event ID as an external reference, preventing a retry from opening a second ticket.
Teams should test resolution events as carefully as failure events. An alert that opens reliably but fails to close leaves stale incidents, noisy escalations, and misleading service health records.
Operational Best Practices and Production Checklist
The hardest webhook failure to diagnose is the one nobody notices. A sender can report successful HTTP delivery while the receiver drops the event after acknowledgement, a queue can accept messages while workers are stuck, or one region can fail while another continues receiving traffic. Operational control requires visibility across the complete path, not just an endpoint access log.
Every receiver should expose metrics for delivery latency, signature failures, duplicate hits, retry rate, permanent failure rate, queue depth, worker age, and dead-letter count. Logs should include the provider delivery identifier, event ID, event type, monitor or resource ID, response status, processing outcome, and region. Those fields let operators distinguish a duplicate from a missing event and a late event from an out-of-order event.
Set delivery and processing objectives for each integration. A rising retry ratio is useful evidence, but universal 10% retry and 1% permanent-failure thresholds are not a substitute for the event’s business importance, volume and normal baseline. Alert separately on a growing oldest-pending age and on missing expected source events.
Detect silent loss
A receiver can't prove that an event never arrived from receiver logs alone. Detection needs reconciliation. Depending on the provider, teams can compare source-side delivery history with receiver inbox records, run periodic API queries for current incident state, or use a provider's event listing to identify gaps.
Use provider delivery history within its retention window, compare it with inbox identifiers and inspect the source’s current state when an event appears missing. GitHub’s webhook best practices explicitly include redelivery of missed deliveries. No receiver-only metric can prove that the sender created and delivered every event.
Use a dead-letter queue for events that fail permanent validation or exhaust processing retries. Replay tooling should require an operator identity, show the original event metadata, support a dry-run or staging target, and record the replay result. Circuit breakers protect ticketing, chat, and payment systems when a burst of webhook events overwhelms downstream dependencies.
Multi-region receivers need a clear ownership model. If more than one region can process the same event, the deduplication store must be shared or the event must be routed to a single authoritative consumer. Otherwise, each region can independently pass its local duplicate check and execute the same side effect.
Production readiness checklist
Before enabling a production webhook notification, confirm the following:
- Transport security: The endpoint uses HTTPS, secrets stay outside URLs, and network filtering is applied where practical.
- Authentication: The receiver validates the raw body signature and handles secret rotation safely.
- Fast acknowledgement: The handler persists or queues accepted events before returning a timely
2xx. - Idempotency: A durable inbox deduplicates deliveries; downstream idempotency and reconciliation protect side effects.
- Schema control: Unknown event types, missing identifiers, malformed bodies, and oversized requests produce deliberate outcomes.
- Observability: Metrics and structured logs expose latency, retries, duplicates, permanent failures, and queue health.
- Recovery: Dead-letter storage, replay tooling, reconciliation, and ownership documentation are available.
- Load protection: Queue limits, worker concurrency, backpressure, and circuit breakers protect downstream systems.
- Incident procedure: Operators know how to identify a missing event, inspect delivery attempts, replay safely, and verify final state.
Fivenines monitoring workflows include a webhook notification channel on eligible plans. Before integrating it, inspect the actual payload, configured authentication and observed delivery behavior; the sample headers and event schema above are not advertised as its protocol. Test both failure and recovery using a staging receiver before connecting ticket creation or remediation. Explore Fivenines for the monitoring side of that workflow.