Webhooks
Learn how to create a webhook endpoint and listen for events.
Creating a webhook endpoint is no different from creating any other page on your website. It's an HTTPS endpoint on your server with a URL. If you're still developing your endpoint on your local machine, it can be HTTP. After it's publicly accessible, it must be HTTPS. You can use one endpoint to handle several different event types at once, or set up individual endpoints for specific events.
Based on the type of integration you want to set up, you will have to decide to which events you want to listen to. You can browse all our webhook events here.
Set up an endpoint on your server that can accept webhook requests with a POST method. Below you can find an example how this could be done in Node (with Express).
01
In this example, the /awell-webhooks
route is configured to accept only POST requests and expects data to be delivered in a JSON payload.
Interactive webhook builder
You can use our interactive webhook builder to build a webhook endpoint in your programming language.
Your endpoint must be configured to read event objects for the type of event notifications you want to receive. Awell sends events to your webhook endpoint as part of a POST request with a JSON payload
The payload structure of each event differs based on the type of event. All webhook payloads do have an event_type
field that you must check. In our API reference under webhooks
you can find the exact payloads for each of the event types. Based on the event type, your endpoint can parse the payload of each event.
Below an example of the pathway.completed
webhook event
01
Your endpoint must quickly return a successful status code (2xx) prior to any complex logic that could cause a timeout.
Awell webhooks have built-in retry methods with an exponential back-off strategy. When we receive a non 2xx HTTP response, we mark the webhook as failed and will retry sending the request. We try re-sending the request up until 24 hours after the initial request.