Webhooks have arrived! They are available on all paid plans.
We are launching webhooks first because of the freedom and flexibility that they provide to you as a developer.
What is a webhook?
A webhook is the act of Submit JSON making an HTTP POST
request to an external API when a submission occurs. This way Submit JSON is able to immediately notify you and your services, and your application doesn’t have to perform complicated polling of our API to determine if a submission occured.
Creating your webhook
- Navigate to the webhooks tab on one of your endpoints.
- Click "Create webhook"
- Enter your URL and any additonal headers.
Testing your webhook
Testing webhooks can be a difficult process. Here are some recommendations from Submit JSON.
Using our built webhook tester
When creating or updating a webhook you can send HTTP POST
requests to your webhook destination with custom headers. Simply click the "test webhook" button to fire a test off.
Using cURL
A great tool for dealing with APIs (and many other things) is curl. In this context, you can use curl to make HTTP requests to your API in the same way that Submit JSON would make requests to your API. You can find an example curl call below.
curl <your-url> \
-X POST \
-H "Content-Type: application/json" \
-d '{
"createdAt": "2023-11-28T03:23:07.668Z",
"data": {
"example": "Webhook Test",
"example2": 1234
},
"emailNotification": false,
"endpointName": "Your Endpoint",
"endpointSlug": "XxXxXxXx",
"seenAt": null,
"submissionId": "xxx-xxx-xxx-xxx-xxx",
"submissionFormat": "pretty",
"submissionSound": "coin"
}'
Using ngrok
Ngrok is a great tunneling service to create a live https url to localhost.
Using RequestBin
RequestBin is a great service to inspect HTTP requests. You can create a temporary RequestBin URL and use the temporary URL as your webhook URL in Submit JSON. RequestBin will then record the HTTP requests and allow you to inspect the HTTP requests to verify headers, JSON bodies, and other information about the request. This will provide you with information about the HTTP requests used in the webhook if you don’t have a public URL set up yet and want to start developing right away.