Webhook Security
Every webhook delivery includes a signature that you should verify to ensure the request originated from RxScale and was not tampered with.Signature Verification
Each webhook request includes a signature header. Verify it by computing an HMAC-SHA256 hash of the request body using thewebhook_secret returned when you registered the subscription.
Example (Python)
Example (Node.js)
Best Practices
Always verify signatures
Always verify signatures
Never process webhook payloads without verifying the signature first. This protects against spoofed requests.
Use constant-time comparison
Use constant-time comparison
Always use
hmac.compare_digest (Python) or crypto.timingSafeEqual (Node.js) to prevent timing attacks.Respond quickly
Respond quickly
You must return a
2xx response within the delivery timeout of 30 seconds. A slower response (or no response) counts as a failed delivery and is retried with exponential backoff — see the Retry Policy.We nonetheless recommend acknowledging much faster than that — a good target is under 5 seconds — by returning 2xx as soon as you have stored the payload and doing any heavy processing asynchronously afterwards. The 5 seconds is a recommendation, not a requirement; only the 30-second timeout is enforced.Handle duplicates
Handle duplicates
Webhook deliveries may be retried. Use the
event_type + timestamp + data.uid to deduplicate events.