Getting your webhook secret
When you create a webhook subscription, the API response includes a secret field. This is the only time the secret is shown — store it immediately in your environment variables or secrets manager.
The response contains the secret:
Save whsec_daca66d... as an environment variable (e.g., RANKED_WEBHOOK_SECRET). You’ll use it to verify every incoming delivery.
The secret is only shown once when the subscription is created. If you lose it, delete the webhook and create a new one.
Verifying signatures
Every webhook delivery includes an HMAC-SHA256 signature in the X-Webhook-Signature header. Use your stored secret to verify the payload hasn’t been tampered with.
Verifying in Node.js
Verifying in Python
Best practices
- Always verify signatures before processing webhooks
- Use
crypto.timingSafeEqual (Node.js) or hmac.compare_digest (Python) to prevent timing attacks
- Return a
200 response quickly, then process the event asynchronously
- Implement idempotency — the same event may be delivered more than once during retries
- Check the
X-Webhook-Timestamp to reject old payloads (e.g., older than 5 minutes)