Send webhooks from a project
Before you begin
- Plan
- Included in Pro and Team. How plans and limits work
- Role
- Admin or higher to create and change a webhook and Editor or higher to send a test.
- You need
- For any destination other than the project's own inbox, a workspace Owner whose email address is confirmed
A webhook is a request your project sends to an address you choose, so the system you are testing can receive callbacks from the API you are mocking. Each delivery is signed with the webhook’s own secret and recorded. This page creates a webhook that fires when you ask it to, and sends it once.
-
Open the project’s Webhooks tab.
-
Select New webhook.
-
Enter a Webhook name you will recognise in the delivery log, such as
Order created. Two webhooks in one project cannot share a name. -
Under Where it goes, choose the Method: POST, PUT or PATCH.
-
Enter the Target URL of your receiver, such as
https://hooks.example.com/orders. With no receiver yet, select Send to this project’s inbox instead, and read what arrives in the project inbox. -
Under What it sends, leave Body template empty to send the standard envelope, or write the body yourself with placeholders such as
{{event}}and{{firedAt}}. -
If your receiver expects a body type other than
application/json, open Content type and headers and change Content type. -
To send a header of your own, such as a key your receiver checks, select Add header under Content type and headers and fill in its name and value.
-
Select Create webhook.
-
Select Copy to copy the signing secret, and keep it where your receiver can read it.
-
Select Done.
-
On the new webhook, select Deliveries.
-
Select Send a test.
The dialog stays open when you select anywhere outside it. Closing it with Close, Cancel or Escape after changing anything asks first: Keep editing goes back to what you entered, and Discard changes closes it.
Leave What fires it empty for a webhook you fire by hand. To fire it when a mock answers or on a schedule, see Fire a webhook when a mock is served and Schedule a webhook.
Content-Type comes from Content type, and MockHub sets the X-MockHub-* headers, which carry the delivery’s identity and signature, and the headers of the connection itself, such as Host, Content-Length and Transfer-Encoding, so no static header can use those names. Webhook signatures and retries lists every reserved name and every header a delivery carries.
A header’s value is stored encrypted and never shown again once the webhook is saved, because it is usually a credential your receiver checks and every member of the workspace can read the webhook. Deliveries still send it.
The signing secret
Section titled “The signing secret”The secret starts with whsec_. It appears unasked only once, when the webhook is created. Afterwards an Admin can read it again: select More actions on the webhook, then Show secret.
Rotate secret, in the same menu, replaces it once you confirm with Rotate secret. Every delivery from then on is signed with the new secret, including retries of earlier ones, and MockHub never signs with both. Update your receiver straight away; Verify webhook signatures explains how to do it without losing deliveries.
Pause, change or delete a webhook
Section titled “Pause, change or delete a webhook”- Pause: turn off the webhook’s switch, labelled Active and the webhook’s name. It is marked Paused, and nothing fires it: not its mock, not its schedule, not Send a test. A delivery still waiting for an attempt fails with “The webhook was disabled before the delivery could run.” Turn the switch on again to resume.
- Change: select Edit, change what you need and select Save changes. Saving does not start a paused webhook.
- Change a header: a saved header’s value field is empty, with the placeholder Hidden; type to replace. Leave it empty to keep the value, or type a new one. A renamed header needs its value typed again, because the hidden value stays with the old name. Moving the webhook to another address, scheme or port, into or out of the project’s inbox, or adding a host it may send to also needs every hidden value typed again or the header removed: a saved value only goes where it was saved for. A new path on the same address, or fewer hosts, keeps them. See Header values are never shown again.
- Delete: select the webhook’s delete button, labelled Delete and the webhook’s name, then confirm with Delete webhook. Its delivery history is deleted with it; pausing keeps both.
Result
Section titled “Result”The message “Webhook created” appears, and the webhook is listed with its method, its target and Only when you send a test. After Send a test, “Delivery queued” appears and the delivery is at the top of the list as Pending.
Once your receiver has answered with a 2xx status, it reads Succeeded with that status, such as 200.
Anything else is explained in Inspect and replay webhook deliveries.
For a JSON body, put string placeholders inside quotes, such as "{{project.name}}". Quotes, newlines and backslashes in their values are escaped. A raw JSON placeholder, such as {{request.body}}, can sit outside quotes. Invalid rendered JSON becomes a Failed delivery before sending.
Limits
Section titled “Limits”The plan sets how many webhooks a workspace can have, across all its projects, and how many deliveries it can send a day and a month; the limits page lists the numbers.
The Webhooks list shows how many the whole workspace has. New webhook is unavailable when that shared ceiling is full.
- Every fire counts against the delivery allowance: a test, a schedule, a mock trigger and a replay. Retries do not.
- With the delivery allowance used up, Send a test is refused with “Webhook event allowance exhausted; no delivery was queued.” Fires from a mock or a schedule are then not sent: the first one refused shows under Deliveries as Failed, and the rest leave no record.
- A webhook can deliver only to a public
http://orhttps://address, and redirects are not followed. See Where a webhook can send. - A webhook that sends to the address a request gives cannot be fired by hand: Send a test is unavailable and the API refuses it with a
409. See Fire a webhook when a mock is served. - The body is built once, when the webhook fires. A body over 262,144 bytes (256 KiB) fails the delivery rather than being cut short.
- In the project’s configuration document, a webhook is known by its name. Renaming it there deletes the webhook and creates a new one, with a new secret and no delivery history. Renaming it with Edit keeps both.
- An alert rule that calls a webhook address is not a webhook and counts against neither the webhook ceiling nor the delivery allowance. Its alerts are signed, retried and recorded as a webhook’s deliveries are, with the rule’s own secret and its own Deliveries page.