Testing and Troubleshooting Webhooks
Test your webhook receiver locally and with a sandbox client, check it is ready for production, and fix common problems.
Use this page once you have a receiver, such as the one in Building a Webhook Receiver.
Test locally
Send an example from any event page to your receiver. For example, save the newTransactions example as new-transactions.json, then run:
curl -i -X POST http://localhost:3000/webhooks/moneyhub \
-H "Content-Type: application/json" \
--data @new-transactions.jsonYou should get a 200 response. JWT webhooks are signed by Moneyhub, so you can't create valid ones locally. Test JWT verification end to end with a sandbox client.
Test end to end with a sandbox client
- Make your receiver reachable over HTTPS, for example with a tunnelling tool, or deploy it to a test environment.
- Set the webhook URL, format, and allowed events on a sandbox API client.
- Trigger events with the test banks.
- Check your logs, and the webhook list on the user's page under API users in the Admin portal. It shows each webhook's type, the status code your endpoint returned, and the payload.
The test banks can trigger these events:
| Event | How to trigger it |
|---|---|
newTransactions | Connect an account with a test bank |
paymentCompleted | Make a successful payment with a test bank |
paymentError | Make a payment with the Open Banking Mock bank using the reference REJECTED |
reauthReminder | Set a connection to expire within 5 days. See Moneyhub Open Banking Mock |
Flushing pending batched events
To test batched webhooks without waiting for the batch interval, you can send all pending batched events for a client straight away from the Admin Portal:
- Open the client in the Admin Portal.
- Select Flush pending events.
- Confirm when prompted.
All queued events for every user of the client are sent immediately to the configured batched webhook URL, using the same batched payload format described in Webhook Format. One batched webhook is sent per user. Once the flush completes, the Admin Portal shows how many events were sent and in how many batched webhooks.
Flushed events are removed from the queue, so they will not be sent again at the next scheduled batch. Events that arrive after the flush are queued as normal.
Flushing is only available:
- for sandbox clients
- to users with the
own_clients_editpermission, for clients they own
Production checklist
- The endpoint uses HTTPS with TLS 1.2 or higher and is reachable from the Moneyhub source IP addresses.
- The endpoint responds with
2xxwithin 5 seconds, and processing happens afterwards. - JWT webhooks are verified for signature, issuer, audience, and age. Keys are fetched from the JWKS URL, not hard-coded.
- If you use JSON format, you restrict requests to the Moneyhub source IP addresses or use a hard-to-guess URL path, and you fetch data from the API rather than trusting the payload.
- Processing is idempotent and doesn't depend on arrival order.
- Unknown event types are accepted and ignored.
- A scheduled job reconciles your data with the API.
- Failed and slow deliveries are monitored and alerted on.
- Only the events you need are enabled in allowed events.
Troubleshooting
| Symptom | Things to check |
|---|---|
| No webhooks arrive | The webhook URL is set on the same API client that created the users. The event is in allowed events. The URL is public, uses HTTPS, and isn't blocked by a firewall. The event's prerequisites, such as scopes or thresholds, are met. |
Delivery history shows status code 500 | Your endpoint returned 500, couldn't be reached, or didn't respond within 5 seconds. Respond before doing any slow work. |
| Some events arrive but others don't | Allowed events, and event prerequisites. For example, regular transaction webhooks need the regular_transactions:read scope, and balance threshold webhooks need thresholds set. |
| JWT verification fails with an issuer error | The issuer must be https://identity.moneyhub.co.uk. This differs from the issuer in the OpenID configuration, which ends in /oidc. |
| JWT verification fails with an audience error | The audience is the client ID of the API client that receives the webhook. |
| JWT verification fails with a signature error | The body was changed before verification, for example by a JSON body parser. Read the body as raw text. Fetch keys from the JWKS URL and select them by kid. |
| JWT verification fails with an algorithm error | Webhooks are signed with RS256. Allow only RS256 in your JWT library. |
| Fewer transaction IDs than expected | Transaction webhooks are sent per account, and large events are split at 6,000 transaction IDs. See transaction webhooks. |
Batched webhooks have no payload | This is expected. Batched webhooks list events without payloads. Fetch the details from the API. |
Updated about 6 hours ago
