Webhooks
#
Creating a webhook- Go to one of your sites
- Go to the "Hooks" tab
- Click "Add"
- Select type "Web"
- Fill in the destination and add a secret (use
openssl rand -hex 32
) - Save the secret somewhere safe, your consumer application will need it
#
Consuming webhooksWebhooks are delivered with a X-Webhook-Signature
header computed as an HMAC using sha256
.
To verify the integrity of a webhook:
- compute the signature of the request raw body using an HMAC with
sha256
and the webhook secret - verify that the computed signature equals the
X-Webhook-Signature
header content
Reference NodeJS TypeScript implementation:
In ExpressJS, the raw body of a request can be obtained as follows: