Webhook is a technical name to indicate a web-based notification that sends a message to an URL when certain actions happen.
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.
List of moments
Cloud4Wi allows you to set up a webhook the following types of events (moments):
- 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
List of webhooks
You can find the list of webhooks in your Cloud4Wi Company Account, from Manage > Notifications.
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.
Create 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
Data returned
Find below the list of all the possible data returned:
- event.type
- event.timestamp
- event.nonce
- event.dwellTime
- organization.id
- hotspot.id
- device.deviceMac
- device.deviceOs
- contact.username
- contact.id
- contact.customFields
- contact.extraFields
- contact.optin
- contact.provider
- contact.ageVerification
- contact.marketing
- contact.civilStatus
- contact.lastname
- contact.firstname
- contact.personalid
- contact.email
- contact.phone
- contact.gender
- contact.country
- contact.birthday
- contact.language
- contact.online
- contact.created
- contact.metrics.visitCount
- contact.type
- location.tags
- location.country
- location.address
- location.id
- location.extId
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:
Headers
Configure the headers below:
Content-Type: application/json Accept-Charset: UTF-8 Cf-Ipcountry: IE Cf-Ray: 3882e1b1980f2969-DUB Accept: application/json Authorization: [[the value you had before for "Auth token"]]
Note: the old version had a field called "Auth token". Now you can configure the same parameters by adding a header parameter called "Authorization".
For example:
if you previously had "Auth token" = "1234567890", now you need to create a new header with key = "Authorization" and the value = "1234567890".
Body
Configure the body parameters below:
- contact.id
- organization.id
- location.id
- hotspot.id (the old system sent this info for "Sign-up" and "Login" moments only)
- event.type
- event.timestamp
- contact.username
- contact.firstname
- contact.lastname
- contact.gender
- contact.phone
- contact.email
- contact.birthday
- 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.provider
- contact.marketing
- contact.type
- 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.civilStatus
- contact.country
- 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:
- lockedRegistration
- deleted