What you will build
Prerequisites
- A public HTTPS endpoint that accepts a
POSTand returns2xx
Set up the webhook
1
Create the webhook destination
Create destinations in the console, not through the API. Open in the environment you want (test or production), find Outbound Webhooks, and add a destination with your endpoint URL. Name it so you can tell destinations apart later. Courier generates a signing secret (
whsec_...). Copy it and store it as a secret in your app. You use it to verify requests really came from Courier.2
Verify the signature and handle events
Courier signs every request with a
courier-signature header. Verify it against the raw request body before you trust the payload. Then branch on the event type. A destination receives every event type, so filter to the ones you care about.Verify
1
Send a message and watch for the event
Send in the same environment the destination belongs to. Within moments your endpoint receives a
message:updated event as the message moves through ENQUEUED, SENT, and DELIVERED.2
Confirm a valid signature passes
Log the result of the signature comparison. If it never passes, check that you are hashing the raw body, not a re-serialized object.
3
Confirm a tampered body fails
Replay a request with one byte of the body changed and confirm your handler returns
401.Skip the consumer
Webhooks drive your own logic. To forward events to a monitoring platform without building a consumer, connect an outbound integration in the console:- A CDP such as or