Verify first
Compute HMAC-SHA256 over <timestamp>.<raw-body> before parsing JSON.
Developer reference
Dependency-free Node.js examples for exact-body HMAC verification, durable event deduplication, fast acknowledgement, bounded polling, and Retry-After.
Compute HMAC-SHA256 over <timestamp>.<raw-body> before parsing JSON.
Use the event UUID as the durable idempotency key, queue it, then return 2xx promptly.
Stop on terminal state, honor 429 Retry-After, and enforce a maximum wait.
Webhook receiver
The example accepts only POST /webhooks/buildwithhq, limits bodies to 1 MiB, validates the five-minute replay window, atomically stores each event UUID once, and keeps customer payloads out of logs.
event.id.BWHQ_WEBHOOK_SIGNING_SECRET=... \
BWHQ_WEBHOOK_QUEUE_DIR=./queue \
node webhook-receiver.mjs
# Local endpoint
http://127.0.0.1:8787/webhooks/buildwithhqconst result = await pollAiRebuild({
saasAppId: process.env.BWHQ_SAAS_APP_ID,
credential: process.env.BWHQ_USER_TOKEN,
jobId: receipt.jobId,
maximumWaitMs: 10 * 60 * 1000,
});
if (result.status === "failed") {
// Record the safe failure and correlation ID.
}Background jobs
The public pollable job contract today is AI rebuild status: POST /v1/apps/{saasAppId}/ai/rebuilds, followed by GET /v1/apps/{saasAppId}/ai/rebuilds/{jobId}.
The poller recognizes completed, failed, and cancelled, waits between nonterminal states, and uses the server’s required whole-second Retry-After value after a 429.
Offline verification
node --test examples/examples.test.mjsDownload testswebhooks.buildwithhq.com publishes reference code and documentation. It does not accept or retain customer webhook deliveries. Deploy the receiver in your trusted backend and give BuildWithHQ that HTTPS destination.