Webhook device status is used to get device status in real time.
This webhook is primarily used if you want to create your own dashboard, then when your client is connecting, the status of the device should also updated.
With this webhook, your device data should correctly updated and reduce the need of hitting api device profile repeatedly which is limited.
Furthermore, you can also use this webhook to notify your client when their device is disconnected along with it's reason.
The example below show how do you get the device status, you can modify as you need.
<?php
header('Content-Type: application/json; charset=utf-8');
$json = file_get_contents('php://input');
$data = json_decode($json, true);
$device = $data['device'];
$status= $data['status'];
$timestamp= $data['timestamp'];
$reason = isset($data['reason'])? $data['reason']:"";
Available parameter
- Device - Your device number (not connected device)
- Status - Device status, connect or disconnect
- Timestamp - Timestamp of the event
- Reason - The reason of disconnect