Receive callbacks in the project inbox
Before you begin
- Role
- Viewer or higher to read what arrived and Admin or higher to point a webhook at it.
Every project answers on the path /__inbox and on every path below it, such as https://orders-api.mockhub.dev/__inbox/stripe. Whatever arrives there is accepted and recorded in the project’s request logs. Point a service you are testing at it to see exactly what its callbacks contain, or give a MockHub webhook somewhere to deliver before your own receiver exists.
-
Open the project’s Webhooks tab.
-
Under This project’s inbox, select the copy button beside the address, named Copy the inbox URL.
-
Enter that address as the callback or webhook address in the service you are testing, adding a path below it that names the sender if you like, such as
/__inbox/stripe. For a MockHub webhook or a webhook alert rule, select Send to this project’s inbox in its form instead. -
Once the service has sent something, select Request logs under This project’s inbox. The request logs open with Webhook inbox chosen under Filters.
-
Select Request and response on a request to see its headers and body.
On a plan without webhooks, the Webhooks tab carries a plan tag, but This project’s inbox is there on every plan. To have each post also arrive at code running on your machine, see Receive webhooks on your machine.
What the inbox does
Section titled “What the inbox does”- It accepts any method on
/__inboxand every path below it, and answers200with the JSON body{"received":true}. Mocks are never consulted there, whatever the project’s gateway mode, so a mock on an/__inboxpath never answers. - The checks every request passes come first: a suspended workspace answers
402, an archived project403, and a request over the plan’s limits413or429. See How MockHub handles a request. - It records each request in the request logs, marked Webhook inbox under Answered by, whenever Store request logs is on. Log requests no mock answered makes no difference to it.
- The project’s logging settings apply as to any request: whether headers and bodies are kept, and which headers are stored as
[REDACTED]. JSON bodies are also redacted by Body keys to redact in captures and a built-in list of sensitive fields; see Captures. - Posts to the inbox are left out of the insights totals, chart and Unmatched requests, though they appear in Busiest endpoints; see Read a project’s insights. They count against the workspace’s request limits like any other request to the project’s address.
Webhooks that deliver to the inbox
Section titled “Webhooks that deliver to the inbox”- A webhook pointed at the project’s own inbox needs no confirmed email address, on any plan: its deliveries never leave MockHub.
- In a demo, the inbox is the only address a webhook can deliver to.
- The destination follows the project. When the project’s subdomain or domain changes, or its domain changes schemes, webhooks and alert rules pointed at its inbox are changed to the new address, keeping the path and query. See Move projects onto a custom domain and Choose HTTPS, HTTP or both for a domain.
- Only the project’s own address counts as its inbox: the same host, on the scheme’s standard port, with no user name, password or
#fragment in the address.https://orders-api.mockhub.dev:8443/__inboxis an outside address, and so is another project’s inbox. - Deliveries to the inbox are signed like any other. While the project logs request headers, the request logs show each delivery’s
X-MockHub-SignatureandX-MockHub-Timestamp. - A delivery to the inbox spends the webhook delivery allowance, and the request it makes counts against the request limits as well.
Test a sender against a failing receiver
Section titled “Test a sender against a failing receiver”The inbox always accepts. To see what a sender does when its receiver fails, point it at an ordinary mock on another path of the project, which answers whatever you give it.
-
On the project’s Mocks tab, select New mock. Set Method to Any method, choose Regex, and enter a path such as
/receiver/.*. -
Under Status code, enter the failure to test, such as
503, and select Save mock. -
Point the sender at an address on that path, such as
https://orders-api.mockhub.dev/receiver/stripe. -
Once the sender has tried, open Request logs. Each attempt is listed, answered by the mock.
To have the receiver fail twice and then accept, give the mock a sequence of responses; for a slow receiver, add a delay.
A MockHub webhook can be pointed at the mock too, as the sender under test. That address is outside the inbox, so it follows the rules for any outside address: an Owner of the workspace needs a confirmed email address, and a demo cannot use it. A 5xx answer is retried twice, so one delivery makes up to three requests, each counted against the request limits; see Retries.
Result
Section titled “Result”The request appears in the list a moment after it arrives, with status 200 and Webhook inbox under Answered by. With the list on its first page, sorted Newest first, new requests appear by themselves; see Read request logs.
Limits
Section titled “Limits”- The inbox belongs to a project and answers only on that project’s address. There is no stand-alone inbox outside a project.
- It answers every request that reaches it with
200and{"received":true}, and cannot be set to answer anything else. To see how a sender copes with a failing receiver, give it a mock on another path instead: see Test a sender against a failing receiver. - Nothing is recorded while Store request logs is off, although the inbox still answers.
- Anyone who knows the address can post to the inbox, and every member of the workspace can read what arrived. Do not send it real customer data or secrets that redaction does not cover.
- Inbox requests are kept as long as the plan keeps request logs.
- On a private project, the inbox uses the project’s access policy like every other path. Own-inbox webhooks and alerts send no project key, so the private policy can refuse them; Gateway access explains the effect. Point them at a public project’s inbox if the private policy prevents delivery.
- Mocks never answer on
/__inbox, so Create a mock from this request on an inbox request makes a mock on the path below it: a request to/__inbox/stripebecomes a mock on/stripe.