#What's a webhook

A webhook is used to trigger an action following an event.
Webhooks are a way for an app or a system to communicate with another one automatically (eg: notifications, alerts, error management, etc.).

#Webhooks et Subscribe

In Subscribe, we use a lot of webhooks to send you notifications about events (user updated, subscription created, modified, etc...).

#Use the webhooks

#1. Define an endpoint

Start by creating a POST endpoint on your server (e.g. https://example.com/webhooks).

#2. Create a new secured webhook

You'll next need to go to your Poool dashboard. Go to the "App settings" section and go to "Secured webhooks".
Here you will be able to create a new endpoint that will receive the selected events.
Select all the events you want to subscribe to, enter the URL of the endpoint you just created in the "URL of the webhook" field and click on "Create".
Once this step is done, you will see your new endpoint on the list of webhooks, with a secret field. The secret is used to validate the request's origin as coming directly from Poool.

#3. Configure your server

First, and to avoid someone else unintendedly using your endpoint, we will be using the previously created secret, allowing us to verify that we are the authors of the request to your endpoint.
You can then process the events you receive as follows:
When we send a webhook event, we take a close look at your server's response to see if the event was handled correctly.
It is therefore important to return an HTTP 200 status code if the event was handled correctly.