We have recently launched a new system to configure webhooks.
If you already configured webhooks before the upgrade to 7.15, then you will be temporarily able to use both systems.
Since the old system will be dismissed in the next few months (currently there is not a deadline for this, we will publish a note into the Admin Panel), we strongly recommend you to migrate to the new system as soon as possible.
Please note that the new system will send the data in a different JSON format.
If you are looking for a guide about the old system, please check here. Below you can find more information about the new system.
Webhook is a technical name to indicate a web-based notification that sends a message to an URL when certain actions happen.
Cloud4Wi allows you to setup a webhook the following types of event:
- Sign-up: the event is triggered after a user is registered to the database (either registration from the Splash Page, Cloud4Wi Dashboard or Kiosk)
- Login: the event is triggered after a guest user signs-in on the guest Wi-Fi
- Presence: the event is triggered after a user's device is detected by the access point
- Enter a Zone: this even is triggered when the customer enters in one of the zones (Virtual or Polygons) configured in the webhook options
- Dwell: this even is triggered when the customer dwell a specific amount of time (configurable in the options) in a location
- Leave: this event is triggered when the customer leave a location. The event is triggered only when the system doesn't receive any signal form the customer for more than a specific period (configurable in the settings of your Cloud4Wi Org.)
- Email verification: triggered when the user verifies his email clicking the verification link sent via email
- Phone verification: triggered when the user verifies his phone number using one of the mechanisms provided by the platform (OTP via SMS, link via SMS)
- Promo Page CTA: triggered when a user clicks the call to action (CTA) button in the promo page published in the Access Journey
Webhooks can be created in the Cloud4Wi Dashboard of your Cloud4Wi Company Account, from Developers > Webhooks.
The page shows a summary of the existing webhooks.
You can check if an existing webhook is enabled or not, you can check on which location it is enabled, you can edit or delete it, or make a test call to the endpoint.
Creating a webhook
To create a webhook you have to click on the Add button on the top of the page.
On the next page, you can set the following data:
- Name: name of your webhook, for inventory purposes
- Moment: the event that triggers the call
- URL: end-point of the HTTP POST request (for example https://yourdomain.com/myapps/webhook.com), The end-point of the HTTP POST request of the webhook can be http and https; if https the server must be correctly configured in order to support the Server Name Indication (SNI) (https://en.wikipedia.org/wiki/Server_Name_Indication)
- Headers: you can define any key-value header to include in your request
- Body: you can choose a list of information about the event, among a given list (etc. you may want to send first name, last name, email, etc.)
- Locations: a list of location where you want to configure the webhook
Find below the list of all the possible data returned:
Possible values: dwell, leave ,login, presence, signup, space, verification.email , verification.phone
Here an example how how the webhook body is formatted (this is for a sign up webhook with all attributes enabled). Note: the order may change
How to migrate a webhook created with the old system
As already mentioned, the new system will send the data in a different JSON format.
If you want to configure a webhook sending the same information as the old version, you have to configure the headers below:
Configure the headers below:
Note: the old version had a field called "Auth token". Now you can configure the same parameters by adding a header parameter called "Authorization".
if you previously had "Auth token" = "1234567890", now you need to create a new header with key = "Authorization" and the value = "1234567890".
Configure the body parameters below:
- hotspot.id (the old system sent this info for "Sign-up" and "Login" moments only)
- event.dwellTime (the old system sent this info for "Dwell" moments only)
- event.nonce (the old system sent this info for "Presence", "Enter a zone", "Dwell" and "Leave" moments only)
- contact.online (the old system sent this info for "Sign-up" and "Login" moments only)
- contact.metrics.visitCount (the old system sent this info for "Sign-up" and "Login" moments only)
- contact.optin (the old system sent this info for "Sign-up" and "Login" moments only)
- contact.customFields (the old system sent this info for "Sign-up" and "Login" moments only)
You will no be longer able to get the following information: