Skip to main content
Empirical lets you verify your application sends the correct webhooks. It integrates with webhook.site to capture and query webhook payloads, and includes a custom Playwright assertion for use in tests. All test repositories managed by Empirical have this built-in — no additional setup is required.

Usage

Create a webhook URL

Use getWebhookUrl to generate a unique webhook.site URL for your test. Configure your application to send webhooks to this URL.

Custom assertion

Use the toHaveReceivedWebhook assertion to verify that a webhook was received. Pass any webhook.site URL to expect() — either one generated with getWebhookUrl or an existing URL — and specify content to match against the body.
The assertion polls webhook.site until a matching webhook is found or the timeout is reached. When multiple content strings are provided, all of them must be present in the webhook body.

Querying webhooks

Use queryWebhookRequests to fetch matching webhook requests directly. This is useful when you need to inspect the payload for further assertions.
Each request in the returned array is a WebhookRequest with the following properties:

Assertion options