How do I build a webhook receiver?
A webhook receiver is your own code, an HTTPS endpoint that Slashbin delivers to as a destination. Slashbin catches the provider’s webhook, reshapes it with your model, and sends the result to your receiver; your receiver checks the signature, stores the event, and answers 200.
What the receiver is, and what Slashbin does
Slashbin receives webhooks from your providers and delivers them to your systems. It does not send webhooks on behalf of your customers, so this guide covers the receiving side only.
| Concern | Your receiver | Slashbin |
|---|---|---|
| Queue and workers behind the endpoint | Yours: store the event, process it after you answer | Not provided for your code |
| Retries of your own processing | Yours | Not provided for your code |
| Reprocessing an event you already stored | Yours | Not provided for your code |
| Delivery attempts to your endpoint | Answer with a 2xx status | Retries a failed delivery with backoff, within a bounded number of attempts |
| Events that could not be delivered or transformed | n/a | Dead Letter Queue |
| Sending a retained event again | n/a | Replay |
Whether you need a queue of your own is covered in Do I need a queue for webhooks?. The Dead Letter Queue is covered in What do I do with my webhook dead letter queue?, and replay in How do I replay webhooks after fixing a bug?. Retention and replay limits depend on your plan; see pricing.
Quick start
Scaffold a receiver with the Slashbin CLI:
npx slashbin-cli init receiver <dir>Then create a data stream in the console, add your receiver’s URL as a destination, and send a test event. The Getting Started walkthrough covers the data stream, model and destination steps.
Verify the signature
Every delivery to your receiver carries the outbound signature:
- Header:
X-Slashbin-Signature - Value:
sha256=followed by the lowercase hex HMAC-SHA256 of the raw request body - Key: the outbound secret of your destination
For the body {"id":"evt_1"} and the secret example-outbound-secret, the header is:
X-Slashbin-Signature: sha256=7d40c9425791e90c80c47b6c5c60f07067059f048ccc5d4e2ad94dcff9422895Compute the HMAC over the exact bytes received, before any JSON parsing, and compare in constant time. How do I verify a webhook signature? shows the check.
This is the signature on deliveries to your receiver. It is separate from the one Slashbin checks on events a custom source sends in, which is a bare hex digest with no prefix; see How do I receive webhooks from any provider?.
Where the events come from
Providers with their own webhooks, such as Shopify, take the default route: a data stream, a model, a destination, and your receiver. For QuickBooks, see QuickBooks webhooks for non-developers.
Need somewhere for the next project’s webhooks to land? Slashbin’s Free plan takes an account, not a card.
Start free
(opens in a new tab)