Sign and verify AI webhook callbacks with HMAC headers
Protect downstream endpoints from forged callbacks using timestamped HMAC-SHA256 signature headers and replay window checks.
Checklist for cryptographic webhook verification
- 01
Sign raw payload plus timestamp
Compute HMAC over timestamp plus raw request body bytes to prevent subtle JSON whitespace mismatches.
- 02
Enforce strict timestamp tolerances
Reject incoming callbacks older than five minutes on your server to block replay attacks.
- 03
Use constant-time comparison
Compare signature digests with timing-safe equality checks inside your backend route handler.
- 04
Test dual-secret rotation
Verify your receiver checks both active and previous signing keys before retiring old secrets.
Common questions
Why include a timestamp inside the HMAC signature?
Signing the timestamp alongside the JSON body guarantees that captured valid callbacks cannot be replayed hours later by an attacker.
Can I rotate signing secrets without breaking live jobs?
Yes. APIkit can emit signatures using dual secrets during a configurable grace window while your backend deploys the new key.
Do you provide verification snippets for Node and Python?
Yes. Copy-paste HMAC verification snippets show raw-body reading and timing-safe checks for Express, Next.js, and FastAPI.
Related tasks in this category
See all in Webhook & Async Event Pipelines-
Enrich incoming webhooks with AI before forwarding
Receive webhook events from GitHub, Linear, or Shopify, enrich payloads with structured AI classification, and relay clean JSON downstream.
-
Run slow AI jobs asynchronously with webhook callbacks
Return an instant HTTP 202 job ID for multi-page extraction or chained prompts, then POST completed JSON to your callback URL.
-
Recover failed webhook deliveries with retries and DLQ
Never lose completed AI outputs when your receiver restarts—automatically retry with exponential backoff and inspect dead-letter queues.
-
Fan out batch arrays into parallel AI endpoint runs
Split one bulk webhook containing 50 items into concurrent per-item model executions, then aggregate typed results cleanly.
-
Deduplicate duplicate webhook runs with idempotency keys
Prevent double token billing and duplicate database updates when third-party senders retry slow or flaky webhook deliveries.
-
Turn raw app events into crisp Slack or Discord alerts
Convert noisy JSON error traces, signups, and churn signals into readable Slack Block Kit summaries delivered automatically.