All articles
webhookstestinghmactutorial

Test Webhook Retries and HMAC Signatures Without Tunnels

Use KestrelMQ's built-in Echo Sandbox to force 500, 429 and timeout responses, watch retries and the dead-letter queue, and check HMAC-SHA256 signatures without a request bin or tunnel.

KestrelMQ Engineering3 min read

Pointing a test webhook at webhook.site sends your payloads to a third-party server, while spinning up ngrok or cloudflared still leaves you editing local route code every time you want to test a 429 or a socket timeout. Every KestrelMQ workspace ships a built-in receiver — the Echo Sandbox at /v1/sandbox/sink/:workspaceId — that forces specific HTTP failure modes and verifies HMAC-SHA256 signatures in-process.

Pick how the receiver fails

Use your workspace ID with either /v1/sandbox/sink/<workspaceId>/<mode> or ?simulate=<mode>:

Echo Sandbox response modes
/v1/sandbox/sink/<workspaceId>/200      delivered (200 OK)
/v1/sandbox/sink/<workspaceId>/500      retried, then dead-lettered
/v1/sandbox/sink/<workspaceId>/429      retried (Retry-After: 5 in the response)
/v1/sandbox/sink/<workspaceId>/timeout  answers after 12s, worker gives up at 10s

In the dashboard, click Test with Echo Sandbox on Deliveries (or Create Sandbox Endpoint on Routing Rules), or set that URL on a webhook integration, add a routing rule, and send an event. Testing Webhooks has the full setup, including the PUBLIC_API_URL and SANDBOX_INTERNAL_URL variables for self-hosted stacks.

Watch the retries

The first attempt fails within seconds and the delivery turns RETRYING. By default the next attempts wait 10s, 1m, 5m and 30m, so the dead-letter queue takes about 36 minutes. To see the whole path quickly on a test stack, set this on the worker and restart it:

.env.selfhost
BACKOFF_SCALE_FACTOR=0.01

After the fifth attempt the delivery is FAILED. Switch the integration to ?simulate=200 and replay it from the dashboard, with POST /v1/deliveries/:id/replay, or with the MCP replay_delivery tool.

Check the signature

You can also call the sink yourself. This signs a body the way KestrelMQ does:

terminal
TS=$(date +%s)
BODY='{"event":"order.paid"}'
SIG=$(printf '%s.%s' "$TS" "$BODY" | openssl dgst -sha256 -hmac "$KESTRELMQ_SIGNING_SECRET" -hex | awk '{print $NF}')

curl -X POST "$KESTRELMQ_BASE_URL/v1/sandbox/sink/$WORKSPACE_ID" \
  -H "Content-Type: application/json" \
  -H "X-KestrelMQ-Timestamp: $TS" \
  -H "X-KestrelMQ-Signature: v1=$SIG" \
  --data-raw "$BODY"

The response returns diagnostic JSON (receivedAt, method, headers, body, signatureValid) — change one byte of the body after signing and signatureValid flips to false:

200 OK · diagnostic response
{
  "receivedAt": "2026-12-03T12:00:01.142Z",
  "method": "POST",
  "headers": {
    "content-type": "application/json",
    "x-kestrelmq-timestamp": "1764763201",
    "x-kestrelmq-signature": "v1=9c4e2b8f01d7a63e54b109c8a72f6d41e80b3c529a14f7d603e8b2c1a490f512"
  },
  "body": { "event": "order.paid" },
  "signatureValid": true
}

To verify in your own receiver, open the delivery in the Delivery Inspector, choose Verify Signature, and copy the pre-filled Node.js, Python, or Go snippet. Add a 300-second timestamp check, as described in secret rotation and verification.

Do not send real customer data to the sink

/v1/sandbox/sink/:workspaceId is intentionally unauthenticated (capped at 300 requests/min per workspace) so outbound workers can hit it like any external receiver. Anyone who knows the workspace UUID can post to that path, so keep sandbox payloads synthetic.

FAQ

Can I test webhook retries without ngrok or a request bin?

Yes. KestrelMQ has a built-in Echo Sandbox at /v1/sandbox/sink/:workspaceId that answers 200, 500, 429 or times out, so retries and the dead-letter queue can be exercised inside your own stack.

How long does it take for a failing delivery to reach the dead-letter queue?

About 36 minutes with the default 5 attempts and backoff delays of 10s, 1m, 5m and 30m. On a test stack, BACKOFF_SCALE_FACTOR=0.01 on the worker reduces that to under a minute.

How do I check that a webhook signature is valid?

The Echo Sandbox returns signatureValid for each signed request, and the Delivery Inspector generates HMAC-SHA256 verification snippets for Node.js, Python and Go.

Self-host KestrelMQ in five minutes

MIT-licensed NestJS, PostgreSQL, and BullMQ stack. Boot locally with Docker Compose or create a free Cloud workspace.