Classic Hotspot Push Contact Notifications allow customers to receive updates about events.
Each customer will be able to expose a public endpoint where the Classic Hotspot Infrastructure will deliver notification messages (through HTTP Post Requests) within useful informations about the event.
Currently the available events are limited to: User Login. The user login push notification is able to send all details of a contact that uses the Classic Hotspot Splash Page to access the WiFi, including Social login (i.e. Facebook) and Social Actions.
How to configure Classic Hotspot to send Push Notifications
In order to activate Push Notifications, please follow the steps shown below:
STEP 1
In order to access to your Social Dashboard go to
cloud.tanaza.com and click on Hotspots
STEP 2
Go to your SSID list on upper right corner, choose the desired SSID and click on
Configure SSID:
STEP 3
Select the Tab Push Notification on the left menu, activate and configure the URL with the one of your endpoint.
Click the Save button to confirm the new configuration.
NOTE
If you want to test the Classic Hotspot push notification while you configure your endpoint, there's a free online tool that can be used.
You can learn more here:
How can I test the Classic Hotspot Push Notification?
This concludes the configuration for the Classic Hotspot Push Notifications, here below you can find some detailed information about the data sent through them.
Public Endpoint
After configuring the feature from Classic Hotspot dashboard as shown, you should now be aware of the new structure to be able to reconfigure your public endpoint in order to receive pushed data in a proper manner.
NOTE
The data in the following tables refer to the latest version
Login Push Object
Login object returned by the push notification and the export
| Field | Type | Format | Example | Values |
|---|
id Exposed id of the database entry | string | | 55876328 | |
ap_id Identifier of the Access Point (MAC address without the colon) to which the client connected | string | |
A0B1C2D3E4F5
| |
SSID Name of the SSID to which the client connected | string | | Wi-fi Hotel Santa Domenica | |
ip_address Ip address of the client who connected to the SSID | string | ipv4 | 195.22.30.56 | |
mac_address MAC address of the client who connected to the SSID | string | mac_address |
AA:A0:C9:14:C8:29
| |
auth_method Authentication method used by the client | string | facebook | google, linkedin, facebook, twitter, instagram, live, tanazaclick, tanaza-email, tanaza-phone, tanaza-emailphone, tanazacode, vk, tanaza-coupon, tanaza-sms, custom_form | |
roaming Flag to identify a connection through roaming | boolean | false | | |
created_at Date and time when the client connected | string | iso8601 | 2015-07- 31T10:23:26.216Z | |
client The client connected to the SSID | object | client | | |
user_agent User-Agent of the device used by the client | string | | Mozilla/5.0 (Linux; U; Android 4.0.3; ko-kr; LG-L160L Build/IML74K) AppleWebkit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30" | |
registered_at Date and time when the client connected for the first time | string | iso8601 |
2015-07-31T10:23:26.216Z
| |
last_login Last time the client connected |
string
|
iso8601
|
2017-07-31T10:23:26.216Z
|
|
logins_count Total count of client connections |
number
|
|
23
| |
Client
The client connected to the SSID
|
Filed
|
Type
|
Format
|
Example
|
Values
|
id Exposed client id of the database entry | string | | 5757935 | |
first_name First name of the connected client | string | | Jon | |
last_name Last name of the connected client | string | | Snow | |
picture Image URL of the connected client | string | url | https://en.wikipedia.org/wiki/File: Jon_Snow- Kit_Harington.jpg | |
gender Gender of the connected client | string | | male | male, female |
email Email address of the connected client | string | email | jon.snow@stark.com | |
phone Phone number of the connected client | string | | +44 393 7649204 | |
birthday Date of birth of the person associated to the client | string | iso8601 | 1978-02-30 | |
location An object describing the location provided by the | object | location | | |
is_phone_verified Verification of phone number | string | | true | true/false |
Location
An object describing the location provided by the client
|
Field
|
Type
|
Format
|
Example
|
Values
|
|---|
name The location name provided by the client | string | | Milan, Area | |
city Name of the city extracted from the location | string | | Milan | |
country_code code of the country extracted from the location | string | | IT | |
latitude Latitude of the location | number | | 40.68906 | |
longitude Latitude of the location | number | | -74.044636 | |
NOTE
Currently the system will not take care of the endpoint response.
If the endpoint fails to catch the request the notification will be lost.
For this reason we highly recommend to test the system before the final release.
Code example in PHP for endpoint implementation
This snippet shows how to get the POST body correctly and how to debug what data is received.
<?php
/*
* Get the request POST body, encoded in json format, and decode it
*/
$json = file_get_contents('php://input');
$logins=json_decode($json,true);
/**
* The $logins variable contains now an array of logins stored as associative array
*/
$logins_count=count($logins);
echo ("Received ".$logins_count." login notifications - ");
for($index=0;$index<$logins_count;$index++){
$login=$logins[$index];
echo "ID login:".$login["id"]." - ";
echo (var_export($login,true))." - ";
}
?>
Example of the content received:
[{
"id": "55876328",
"ap_id": "Wi-fi Hotel Santa Monica",
"SSID": "Wi-fi Hotel Santa Monica",
"ip_address": "98.139.180.149",
"mac_address": "00:A0:C9:14:C8:29",
"auth_method": "facebook",
"created_at": "2015-07-31T10:23:26.216Z",
"user_agent": "Mozilla/5.0 (Linux; U; Android 4.0.3; ko-kr; LG-L160L Build/IML74K) AppleWebkit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30",
"client": {
"id": "5757935",
"first_name": "Jon",
"last_name": "Snow",
"picture": "https://en.wikipedia.org/wiki/File:Jon_Snow-Kit_Harington.jpg",
"gender": "male",
"email": "jon.snow@stark.com",
"phone": "+44 393 7649204",
"birthday": "02-10-1978",
"location": {
"name": "Milan Area",
"city": "Milan",
"country": "Italy",
"country_code": "IT",
"latitude": 40.68906,
"longitude": -74.044636
},
"logins_count": 23,
"terms_and_conditions": "{\"general\": true, \"marketing\": false}"
}
}]
NOTE
If you want to test the Classic Hotspot push notification while you configure your endpoint, there's a free online tool that can be used.
You can learn more here:
How can I test the Classic Hotspot Push Notification?