The first step to adding webhooks to your account integration is to build your own custom endpoint. Creating a webhook endpoint on your server is no different from creating any page on your website.
Before looking at the code, there are two different versions of webhooks. To learn more about which webhooks version each API or channel uses, and how to set them up with your application, please see the table below. You should also review the best practices.
To acknowledge receipt of an event, your endpoint must return a 2xx HTTP status code to us. All response codes outside this range, including 3xx codes, indicate to us that you did not receive the event.
If we do not receive a 2xx HTTP status code, the notification is retried. After 5 failures to send the notification, we mark the event as failed and stops trying to send it to your endpoint.
Because properly acknowledging receipt of the webhook notification is so important, your endpoint should return a 2xx HTTP status code prior to any complex logic that could cause a timeout.
As your webhook endpoint is used asynchronously, its failures may not be obvious to you until it’s too late. Always test that your endpoint works:
- Upon initial creation
- After taking it live
- After making any changes
The Test Webhooks page explains how to test your endpoint.
Updated over 2 years ago