Webhook testing: capture, verify and mock webhooks
Each hook is its own HTTPS address. Point webhooks at it, from Stripe, GitHub, Shopify, Slack, Twilio or your own app, and every request is captured, its signature checked and its reply mocked. Your tests wait for the one they expect. It captures any HTTP request too, so it can also stand in for an API your app calls.
An address for every hook, a record of every request
Each hook gets its own address, https://<token>.assertrelay.dev/. Paste it into a provider's webhook settings or your app's config, and every request to it is kept: method, path, query, headers, body, the sender's IP and the time.
- Every method and every path under the address
- Throwaway hooks for test runs, which expire after a set time (1 minute to 24 hours)
- Tags, variables and checks, the same as on email
- Copy a request as curl, HTTPie, fetch or Java, or export as HAR, a Postman collection or JSON lines
Signatures checked as each request lands
Add the signing secret once. Each request is marked valid, invalid or missing, with the reason, so a test can fail on a bad signature instead of trusting it.
- Ready for Stripe, GitHub, Shopify, Slack, Twilio and Standard Webhooks, or your own HMAC
- Rotate a secret with no gap: old and new both pass while you switch
- Guard a hook with a required header, basic auth or an IP allowlist
Answer like the real API, or like its worst day
A hook can stand in for an API your app calls. Rules pick the reply by method, path, headers or body, so you can test the error paths that are hard to reach for real.
- Sequences, such as 500, 500, then 200, and scenarios that change state
- Templates that fill in IDs, times and values from the request
- Delays, timeouts and malformed JSON, to test retries and error handling
- Parallel tests add their own short-lived rules to one shared hook
Wait for the webhook, then assert on it
Make a throwaway hook, point your app or a provider's test mode at it, and wait for the request you expect. One test can wait for the receipt email and the payment webhook, with one client.
- Wait by method, path, header, JSON field, tag or signature result
- Count calls, or check that none came within a set time
- Listen from your machine: each new request is sent on to your local app
Not on npm yet. Ask [email protected] for early access to the SDK. Any language can use the REST API.
import { test, expect } from '@playwright/test'; import { AssertRelay } from '@assertrelay/sdk'; const relay = new AssertRelay(); // reads ASSERTRELAY_API_KEY test('paying an order sends a webhook', async ({ page }) => { // 1. a throwaway hook as the app's webhook address const hook = await relay.hooks.create({ ttl: '1h' }); await page.goto('/settings/webhooks'); await page.getByLabel('Endpoint URL').fill(hook.url()); await page.getByRole('button', { name: 'Save' }).click(); // 2. trigger it await page.goto('/orders/1042'); await page.getByRole('button', { name: 'Mark as paid' }).click(); // 3. wait for the request and assert on its body const req = await relay.hooks.get({ hook, json: { '$.type': 'order.paid' }, timeout: 30_000, }); expect(req.json().data.order_id).toBe('1042'); });
Do something with each request
Rules pick which requests trigger an action.
Send to chat or a webhook
Post to Slack, Microsoft Teams or Discord, or send a signed webhook of your own, when a matching request arrives.
Forward and replay
Send requests on to your app as they arrive, or replay a captured one to check a fix. On paid plans.
Listen locally
Re-send each new request to localhost from your own machine, with the SDK or the command line. Nothing has to reach your laptop from outside.
Export
Any request as curl, HTTPie, fetch or Java code, or a whole hook as HAR, a Postman collection or JSON lines.
Webhooks on every plan
Plans differ in requests per day, retention period, and how much you can mock and send. Compare plans
Webhook testing questions
Is it only for webhooks?
No. A hook captures any HTTP request, so you can also point your app at it in place of a third-party API and mock that API's replies, errors and delays.
Which webhook signatures can it check?
Stripe, GitHub, Shopify, Slack, Twilio and Standard Webhooks are ready to pick, and other HMAC signatures can be set up by hand. Each request shows whether its signature is valid, invalid or missing.
Can my test wait for a webhook instead of sleeping?
Yes. The SDK and REST API wait until a matching request arrives, by path, header, JSON field, tag or signature result, and fail with a clear reason if none comes in time.
Can I send webhooks on to my local app?
Yes. Listening from the SDK or the command line re-sends each new request to a local address from your own machine. Forward and replay to an address you add are on paid plans.
How long are requests kept?
1 day on Free, 7 days on Personal, 14 days on Team, and set per contract on Enterprise.
What happens when a plan limit is reached?
The hook answers 429 with a Retry-After header, so the sender tries again later, and a test that is waiting is told at once instead of timing out.