This is a step by step guide to make use of the Webhook, to connect data directly from our platform to another 3th party platform or database.
------------------------------------------------------------------------------------------------------
Webhook for login events
Webhooks can be used to notifiy your own application about events at one or more of your SO Connect venues. Our servers will make a HTTP POST to an endpoint you can configure that will contain all data related to that request in the body as a JSON object. The requests will come in (near-)realtime and can be processed by your application to suit your needs.
Currently only one 'event type' is supported being the 'wifi_login' type. This event is triggered every time a wifi login has taken place at a venue. Please note that if a user logs in multiple times you will receive multiple requests for the same user.
The endpoint should return a 200 status in order for our system to consider it successful. When a request fails it will be retried every minute for a maximum of 10 minutes.
The IP range the requests will be coming from is 87.233.181.32/27, make sure to whitelist this on your server/firewall.
Configuring the webhook
Currently webhooks cannot be configured in the SO Connect Dashboard (yet).
To enable a webhook for your application please send the following information to support@sowifi.com:
- Endpoint url - should be https
- Location id's that should be linked to this endpoint or if you want all locations then your account id will suffice
SO Connect will then enable the webhook and notify you once done.
Testing the webhook
For testing we have some test locations available. Before going to production we can configure your endpoint there. You will receive a test login link so you can perform tests with actual data.
Payload description
- Event: information about the event itself
- timestamp (integer): the unix timestamp of the event in UTC
- type (string 20): the type of the event (currently only 'wifi_login')
- Location: information about the location the event has taken place
- id (integer): the id of the location in the SO Connect Dashboard
- name (string 255): the name of the location as set in the SO Connect Dashboard
- external_reference (string 255): the external reference of the location as set in the SO Connect Dashboard
- timezone (string 90 - full list here: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones): the timezone of the location as set in the SO Connect Dashboard. This can be used to convert the event to a local time.
- latitude (decimal): the latitude of the location (only available when using SO Connect hardware)
- longitude (decimal): the latitude of the location (only available when using SO Connect hardware)
- Account: information about the customer the location belongs to (the id and name of the venue, restaurant, hotel etc.)
- id (integer): id of the customer in the SO Connect Dashboard
- name (string 255): name of the customer as configured in the SO Connect Dashboard (ie. Hotel Europa - Amsterdam)
- User: information about the wifi user / guest that logged in to the wifi at the location (if available)
- id (integer): id of the user in the SO Connect Dashboard
- type (string 20): type of the user (facebook,twitter,linkedin,email,instagram,vk,voucher,login_skip)
- email (string 255): email address of the user
- locale (string 5): locale of the user
- first_name (string 255)
- last_name (string 255)
- city (string 255): current city of the user as provided by Facebook
- gender (string 1): M/F
- date_of_birth (string 12): in the format yyyy-mm-dd
- Device: information of the device that was used to login
- user_agent (string 255): the user agent of the browser
- mac_address (string 17): the wifi mac address of the device in the format (11-22-33-AA-BB-CC)
An example payload:
{
"event": {
"timestamp": "1512548314",
"type": "wifi_login"
},
"location": {
"id": "12345",
"name": "SO Connect Headquarters",
"external_reference": "SCT-001",
"timezone": "Europe/Amsterdam",
"latitude": 52.3653963,
"longitude": 4.8790649
},
"account": {
"id": "123456",
"name": "SO Connect"
},
"user": {
"id": "13352700",
"type": "facebook",
"email": "test-user@soconnect.io",
"locale": "en_US",
"first_name": "Michael",
"last_name": "Jackson",
"city": "New York, United States",
"gender": "M",
"date_of_birth": "1991-03-07"
},
"device": {
"user_agent": "Mozilla/5.0 (Linux; Android 7.0; SM-G920F Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/62.0.3202.84 Mobile Safari/537.36",
"mac_address": "EC-1E-72-EA-AC-BF"
}
}
Request Headers
By default the 'Event-Type' is sent in the headers as is the content type - which is set to 'application/json' by default.
Event-Type: wifi_login
Content-Type: application/json
Custom request headers can be added upon request.
------------------------------------------------------------------------------------------------------
This concludes the SO Connect Webhook guide.
Comments
0 comments
Please sign in to leave a comment.