Webhook Sandbox Testing
After you've configured your system to receive Branch Webhook notifications, you can use the Branch sandbox environment to manually trigger and test webhooks. Sandbox webhooks are for simulation purposes only and will not update account statuses when triggered.
Prerequisites
- API key to authorize webhook trigger
- Base64 AES Decryption key to decrypt webhook data field: See Webhook Security for more details.
- Organization ID
- The name of the webhook you want to test. For example,
ACCOUNT_VERIFIED_AS_WORKER
NOTE: When you manually trigger webhooks in the sandbox, it will autogenerate values for response fields that you do not provide in the data block of your request. For example, if you omit employee_id
from the request shown below, Branch will send a webhook with employee_id: 1
inserted.
Testing
Starting with this API Post template, modify it by inserting your org ID, webhook type, and apiKey where indicated in the template:
curl --location --request POST 'https://sandbox.branchapp.com/v1/organizations/<your_org_id>/webhooks/<webhook_type>' \
--header 'apiKey: <your api key>' \
--header 'Content-Type: application/json' \
--data-raw '{
"employee_id": 123,
"account_number": 123,
"routing_number": 123
}'
Using cURL
To test a Webhook from a terminal or command prompt, paste the code above with your details inserted into the terminal or prompt window.
For example, to trigger an ACCOUNT_VERIFIED_AS_USER
webhook in a case where your org ID is 999
, the employee ID you're checking 123
, and your api key abcdefghijklmnopqrstuvwxyz
, your code would look like this:
curl --location --request POST 'https://sandbox.branchapp.com/v1/organizations/999/webhooks/ACCOUNT_VERIFIED_AS_USER' \
--header 'apiKey: abcdefghijklmnopqrstuvwxyz' \
--header 'Content-Type: application/json' \
--data-raw '{
"employee_id": 123,
"account_number": 456,
"routing_number": 789
}'
If you receive any errors in return, check your details for accuracy or troubleshoot any security or access issues. A successful call will not return anything in the terminal, since the goal is to trigger a webhook event being sent to your system.
Using Postman
Download the Postman Webhook Event Collection
If you want to test webhooks using Postman, follow these steps.
- Open a Postman collection and select New Request.
- Enter the POST URL from the code template as shown in the image below.
- Click the Authorization tab.
- Next to Type, use the drop-down menu to select Api Key.
- Next to Key, enter
apiKey
in the field. - Next to Value enter your API key in the field.
- Leave Add to set to Header.
- Click the Body tab.
- Select the raw button.
- Paste the body of your request as shown here. Only insert the lines enclosed in curly brackets, don't include other lines from the curl request.
If your POST is successful, Status: 200 OK appears at the bottom right, or if there are errors you see an error response.
Updated 22 days ago