Webhooks

Last updated 3 days 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

devic.disconnected and device.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

location_permission.not_requested

Sent when the location permission has not been requested by your app

Android, iOS

activity.disabled and activity.enabled

Sent when activity tracking (called Fitness Tracking on iOS) is disabled and enabled on the device

iOS only

activity.not_supported

Sent when activity tracking (called Fitness Tracking on iOS) is not supported on the device. E.g., for iPhones 5 and below, iPads and simulators

iOS only

activity_permission.denied and activity_permission.granted

Sent when the motion permission, required to track activity, to your app has been denied and granted

iOS only

activity_permission.not_requested

Sent when the motion permission, required to track activity, has not been requested by your app

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"
}
}