Webhooks

Last updated 2 months ago

Activity change and offline alerts

HyperTrack generates and sends you live stream of activity change events as your user moves. In addition, HyperTrack sends you device health change events for your to know when the device gets disconnected, when the location gets turned off and more. Read more about events here.

Activity change

Here is the format of the data JSON that is sent for an activity change event.

PROPERTY

TYPE

DESCRIPTION

activity

String

Current activity. Could be: stop, walk, run, cycle, or drive

place

JSON

JSON containing information of the place where activity changed

previous_activity

String

Previous activity

route

String

JSON containing duration, distance and polyline of the pervious activity

Place

Here is data that is sent within the place JSON.

PROPERTY

TYPE

DESCRIPTION

name

string

Name of the entity. E.g., WeWork

location

GeoJSON

Location in GeoJSON format

id

string

Unique identifier of the place

type

string

Type of the place, e.g., restaurant, hotel, apartment

subtype

string

Sub-type of the place

tag

string

‚Äč

Sample event

{
"id": "5e07df7e-cf01-4571-b516-e76e366efb90",
"device_id": "17e2a12d-d8de-43d1-9566-849135fdb577",
"type": "activity.change",
"recorded_at": "2018-07-20T04:09:33.945000+00:00",
"data": {
"activity": "walk",
"place": {
"id": "2b0bab1f-2892-46ce-846a-528949d10431",
"location": {
"coordinates": [
77.6342144,
12.929061
],
"type": "Point"
},
"name": "5th Main Road",
"type": "highway",
"subtype": "residential"
},
"previous_activity": "stop",
"route": {
"distance": 287.4997373414002,
"duration": 50846,
"polyline": "kd|mAq{yxMz@u@???E`@oD????c@zD?@y@c@"
}
}
}

Health change

Here is the format of the data JSON that is sent for a health change event.

PROPERTY

TYPE

DESCRIPTION

value

String

Value of health change event. See possible values below.

place

JSON

JSON containing information of the place where health changed

Here are possible values of health change events:

Value

Description

Support

disconnected and reconnected

Sent when the device gets disconnected and reconnected from the server

Android, iOS

tracking_paused and tracking_resumed

Sent when the pauseTracking and resumeTracking methods are called on the SDK

Android, iOS

sdk_killed and sdk_restarted

Sent when the service (which is running in the background) gets killed and restarted by the OS

Android, iOS

gps_lost and gps_found

Sent when the device loses and regains GPS signal (which may happen when you are in a train or in a basement)

Android only

location_disabled and location_enabled

Sent when location is disabled and enabled on the device

Android, iOS

location_permission_denied and location_permission_granted

Sent when the location permission to your app has been denied and granted

Android, iOS

activity_permission_denied and activity_permission_granted

Sent when the motion permission to your app has been denied and granted

iOS only

airplane_mode_on and airplane_mode_off

Sent when the device has been put on airplane mode

Android only

battery_low and battery_normal

Sent when the battery goes below 20% on iOS; and when the OS sends battery_low warning on Android (this is the battery-low system dialog that shows up on device)

Android, iOS

device_switched_off and device_switched_on

Sent when the devices has been switched off and switched back on

Android only

Sample event

{
"id": "29e06161-d060-4972-944a-7ed9a9113f77",
"device_id": "17e2a12d-d8de-43d1-9566-849135fdb577",
"type": "health.change",
"recorded_at": "2018-07-19T18:45:57.366896+00:00",
"data": {
"place": {
"id": "8f3ac83f-f144-425f-afc6-a6f56ba88746",
"location": {
"coordinates": [
77.6351878,
12.9283948
],
"type": "Point"
},
"name": "2nd Main Road",
"type": "highway",
"subtype": "residential"
},
"value": "device.disconnected"
}
}