Live Check-in

Last updated 11 days ago

App events tagged on the Placeline

Create check-in event

Add a point-in-time-and-place check-in event from a device using the following iOS/Android SDK method. Callback returns errors if you add a check-in event before SDK is initialized.

iOS (Swift)
iOS (Obj C)
Android (Java)
let name = "payment"
let metaData : [String : Any] = ["order_id" : 505054, "customer_name" : "Alex"]
HyperTrackCore.createCheckin(forName: name, metaData: metaData) { [weak self] (error) in
/// handle error if any
}
NSString *name = @"payment";
NSDictionary *metaDict = [NSDictionary dictionaryWithObjects:@[@505054, @"Alex"]
forKeys:@[@"order_id", @"customer_name"]];
[HTCore createCheckinForName:name metaData:metaDict completionHandler:^(HTCoreError * _Nullable error) {
/// handle error if any
}];
String name = "payment";
HashMap<String, String> metadata = new HashMap<>();
metadata.put("order_id", "678990");
metadata.put("customer_name", "Alex");
HyperTrackCore.createCheckin(name, metadata, new HyperTrackCallback() {
@Override
public void onSuccess(@NonNull SuccessResponse response) {
Log.d("MainActivity", "successfully created check in events");
}
@Override
public void onError(@NonNull ErrorResponse errorResponse) {
Log.d("MainActivity", "failed to create check in events");
}
});

Name

Type

Description

name

String

Name of the check-in event

metadata

Dictionary

Dictionary of type <String, Any>. Use this to send extra information with check-in event.

completionHandler

Block

A callback which takes an optional CoreError as a parameter and returns Void. Use this handler to determine if there were any issues while sending check-in event.

Consuming check-in event

The check-in events that you create via the SDK can be consumed across different platforms.

Webhook

Enable webhook to receive check-in events on your server. To enable webhook, visit the console, add your webhook URL, and select check-in as the event type. Here is the format of the data JSON that is sent for a check-in event.

PROPERTY

TYPE

DESCRIPTION

name

string

Name of the check-in event that was sent by you

metadata

JSON

Metadata of the check-in event that was sent by you

activity

string

Activity of the device when the check-in event was sent. Could be: stop, walk, run, cycle, driveor no_data if the activity is unknown

location

GeoJSON

Location of the device, in GeoJSON format, when the check-in event was sent

no_data_reason

string

Reason why the activity and/or location is unknown when the check-in event was sent. Could be one of the following:

  1. tracking_paused

  2. sdk_killed

  3. gps_lost

  4. location_disabled

  5. location_permission_denied

  6. activity_permission_denied

  7. airplane_mode_on

  8. device_switched_off

Sample event

{
"id": "5e07df7e-cf01-4571-b516-e76e366efb90",
"device_id": "17e2a12d-d8de-43d1-9566-849135fdb577",
"type": "checkin",
"recorded_at": "2018-07-20T04:09:33.945000+00:00",
"data": {
"name": "payment",
"metadata": {
"order_id" : 505054,
"customer_name" : "Alex"
},
"activity": "walk",
"location": {
"coordinates": [
77.6342144,
12.929061
],
"type": "point"
}
}
}

API

This product feature is still under development and is not available in production. Please reach out to us on Slack if you want an early access.

API to fetch checkins for a device between two timestamps

Note

  1. Maximum allowed time range is of one day; queries that exceed that will given an error

  2. Historical data beyond 7 days is not available

HTTP Request

GET https://api.hypertrack.com/v3/checkin/

Parameters

Parameter

Type

Description

Required

device_id

UUID string

ID of the device

Required

from_timestamp

ISO datetime string

Time from which you want the data

Required

to_timestamp

ISO datetime string

Time to which you want the data

Optional; defaults to current time

Sample Request

curl
--request GET
--url https://api.hypertrack.com/v3/checkin/
--header 'Authorization: token SECRET_KEY'
--header 'Content-Type: application/json'
--data '{
"device_id": "5d728988-9c23-4bd7-bfc3-048918199d53",
"from_timestamp": "2018-10-20T08:00Z",
"to_timestamp": "2018-10-20T09:00Z"
}

Returns

Property

Type

Comment

device_id

UUID string

Device ID sent in the request

from_timestamp

ISO datetime string

From timestamp sent in the request

to_timestamp

ISO datetime string

To timestamp sent in the request

checkins

JSON

An array of checkins

Each checkin will have following properties:

Property

Type

Comment

id

UUID string

recorded_at

ISO datetime string

name

String

metadata

JSON

activity

String

Activity of the device when checkin event was sent. Could be: stop, walk, run, cycle, driveor no_data if the activity is unknown

location

JSON

no_data_reason

String

Reason why the activity and/or location is unknown when the checkin event was sent. Could be one of the following:

  1. tracking_paused

  2. sdk_killed

  3. gps_lost

  4. location_disabled

  5. location_permission_denied

  6. activity_permission_denied

  7. airplane_mode_on

  8. device_switched_off

Sample Response

{
"device_id": "5d728988-9c23-4bd7-bfc3-048918199d53",
"from_timestamp": "2018-10-20T08:00Z",
"to_timestamp": "2018-10-20T09:00Z",
"checkins":{
{
"id": "5e07df7e-cf01-4571-b516-e76e366efb90",
"recorded_at": "2018-07-20T04:09:33.945000+00:00",
"name": "payment",
"metadata": {
"order_id" : 505054,
"customer_name" : "Alex"
},
"activity": "walk",
"location": {
"coordinates": [
77.6342144,
12.929061
],
"type": "point"
}
},
...
}
}