Skip to main content

Webhook sending: how to send webhooks from your service

Sending a webhook means making an HTTP POST to a URL the receiver registered, with the event as a JSON body. That one request is the whole protocol. Webhook sending as a system is everything around it: choosing which events to send, signing each one, queueing it, retrying failures, and showing customers what was delivered.

If you only need to post a message into someone else’s product, the platform guide is the shorter path: Slack, Discord, or Microsoft Teams. This page is for the other side: an API or SaaS product that delivers its own events to webhook endpoints its customers control.

Sending webhooks?
Svix is the enterprise-ready webhook sending service. It handles signing, retries, and delivery observability, so you can ship a reliable webhook platform in minutes instead of months. Start sending webhooks with Svix.

What a webhook send looks like​

A send is a POST with a JSON body and a Content-Type: application/json header. A production sender adds three more headers: an ID for the message, the time it was sent, and an HMAC-SHA256 signature computed over the ID, timestamp, and body with a secret shared with that one endpoint.

POST /hooks/billing HTTP/1.1
Host: example.com
Content-Type: application/json
webhook-id: msg_2Nf8Qp
webhook-timestamp: 1741112530
webhook-signature: v1,g0hM9SsE+OTPJTGt/tmIKtSyZlE3uFXCma1BgF/2Hps=

{"type":"invoice.paid","timestamp":"2025-03-04T18:22:10Z","data":{"id":"inv_2Nf8"}}

The header names come from the Standard Webhooks specification. Using them means your customers verify with an existing library instead of code written for your service.

The receiver recomputes the signature from the ID, timestamp, and raw body, rejects the request if it does not match or the timestamp is too old, and answers with a 2xx. Any 2xx counts as delivered. Anything else, including a timeout, is a failed attempt that goes back on the queue.

Decide which events to send​

Not every change in your system deserves a webhook. Start with what customers act on: a resource created, updated, or deleted, a status change such as an order shipping or a payment failing, a threshold such as usage nearing a limit. Name them with one convention and give every payload the same envelope, with the ID, type, and timestamp at the top level and the resource under data. Designing webhook payloads covers the tradeoffs.

Where the event is emitted matters more than it looks. Calling the sender from application code is quick to write and easy to forget in the next code path that changes the same record. Writing the event to an outbox table in the same transaction as the state change, with a separate process reading that table, means a committed change always produces its event.

Sign every request​

Without a signature, anyone who learns an endpoint’s URL can post to it and the receiver cannot tell. Sign with a secret unique to each endpoint, so one leaked secret exposes one customer, and include the timestamp in the signed content so a captured request cannot be replayed weeks later.

Signing protects the receiver. The sender has its own exposure, because it makes requests to URLs that customers typed in. A customer who registers an internal address turns your delivery workers into an SSRF tool. Resolve each hostname and refuse private, loopback, and link-local addresses, ideally by sending through a proxy that sits outside your internal network.

Send from a queue and retry​

Never send inline from the request that caused the event. A customer endpoint that takes 30 seconds to answer would hold your own API for 30 seconds. Persist the event, enqueue the delivery, and let workers send it, with a timeout of 5 to 30 seconds on each attempt.

Retry failed attempts with exponential backoff and jitter, spread over hours, since customer deploys and outages outlast a few seconds of retrying. Keep the same message ID on every attempt so receivers can build idempotency on it, and move messages that exhaust the schedule to a dead letter queue instead of dropping them. The webhook reliability guide explains each mechanism.

Isolate endpoints from each other​

One event usually goes to many endpoints, which is webhook fanout, and those endpoints fail independently. If every delivery shares one queue, a single slow endpoint delays everyone behind it: the noisy neighbor problem. Track state per endpoint instead. Pause one that is failing repeatedly with a circuit breaker, and disable one that has failed for days and notify its owner, so dead integrations stop consuming retries. Webhook scalability covers what breaks first as volume grows.

Show customers their deliveries​

When an event does not arrive, the customer’s first question is whether you sent it. Record every attempt with its timestamp, response code, and latency, and expose that log in your dashboard and your API. Let customers replay a message themselves, send a test event to a new endpoint, and subscribe only to the event types they handle. Without these, every missed webhook becomes a support ticket asking your engineers to check the logs.

Webhook sending checklist​

Sending webhooks well means each event is persisted before delivery, signed with a per-endpoint secret, sent with a short timeout, retried on a published schedule, and logged so it can be replayed. The sections above reduce to these defaults:

DefaultWhy it matters
Persist the event, then deliver it from a queueA crash between commit and send loses nothing
Sign every attempt over a timestamp and the body, using the Standard Webhooks headersConsumers verify with an off-the-shelf library
Time out each attempt after 5 to 30 secondsA hung endpoint cannot hold a delivery worker
Retry on backoff for a day or more; Svix makes eight attempts over about 27 hours (schedule)Covers deploys and short outages
Keep the same message ID on every attemptReceivers can deduplicate retries
Disable endpoints that fail for days, and notify the ownerDead endpoints stop consuming retries
Keep exhausted messages in a dead letter queue with per-message and bulk replayCustomers recover without a support ticket

Build the sender or buy it​

You can get a first version out pretty fast: a queue, a worker, and an HMAC call. How to build a webhook sender does it in Python. The difficulty is in the tail. It is cheap to deliver 99% of your webhooks and nontrivial to guarantee delivery for all of them, and per-endpoint isolation, secret rotation, SSRF protection, replay, and customer-facing logs are where that work goes.

If webhooks are a feature your customers asked for and not your product, keep the parts that encode your business and weigh the rest. How to add webhooks to your API product covers the event catalog and subscription model you have to own, and how to evaluate webhook infrastructure covers what to ask of a delivery layer you buy. Svix is that webhook infrastructure as a service, behind one API call per event, and the build vs. buy comparison prices both paths.