What are webhooks
Webhooks refers to a combination of elements that collectively create a notification and reaction system within a larger integration.
Metaphorically, webhooks are like a phone number that RemoveBounce calls to notify you of activity in your RemoveBounce account. The activity could be starting cleaning one of your lists or finishing it. The webhook endpoint is the person answering that call who takes actions based upon the specific information it receives.
Non-metaphorically, the webhook endpoint is just more code on your server, which could be written in Node.js, PHP, Ruby etc.
The webhook endpoint has an associated URL (e.g., https://example.com/webhooks). The RemoveBounce notifications are Event objects.
Event object contains all the relevant information about what just happened, including the type of event and the data associated with that event.
The webhook endpoint uses the event details to take any required actions, such as indicating that an email list has been cleaned.
Receive event notifications with webhooks
Listen for events on your RemoveBounce account so your integration can automatically trigger reactions.
Begin using webhooks with your RemoveBounce integration in just three steps:
- Create a webhook endpoint on your server.
- Send test events from your RemoveBounce Dashboard to test that your endpoint works.
- Register the endpoint with RemoveBounce to go live.
Return a 2xx status code quickly
To acknowledge receipt of an event, your endpoint must return a 2xx HTTP status code. All response codes outside this range, including 3xx codes, indicate to RemoveBounce that you did not receive the event.
If RemoveBounce does not receive a 2xx HTTP status code, the notification attempt is repeated up to 5 times. After multiple failures to send the notification over multiple days, RemoveBounce disables the 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 could cause a timeout.
Why do we use webhooks
Many events that occur within a RemoveBounce account have synchronous results–immediate and direct–to an executed request. For example, a successful request to check your balance immediately returns an object. Such requests don’t require webhooks, as the key information is already available.
Other events that occur within a RemoveBounce account are asynchronous:
happening at a later time and not directly in response to your code’s execution.
An asynchronous event is when you
POST a list of emails and you are waiting for its validation.
We decided to use webhooks due to their simplicity: you ask us to do some work, we get to it, we will let you know once we are done.
Also, the alternative would have been for you to poll for your results. Polling creates unnecessary traffic and loads on both your systems and ours.
We saw that webhooks are an elegant solution to notify you of the events that you are interested in.