Geofencing

[info] Under development

This is private release, and under active development. For early access, reach out to us at help@hypertrack.com, or on our Slack.

HyperTrack Geofences lets you define rules that are important for your business and triggers notification when the rule is satisfied.

A geofence rule can be, Tom has reached a warehouse or Jill is at a rental property for over 2 hours. You define the rules by creating a Geofence record. When these rules are satisfied we trigger a geofence and send you a notification through the Event object. You can receive these Events on your server via webhooks or a communication platform like Slack, along with all the important details (when, where, how long etc).

Step 1: Plug in the SDK and start tracking

Plug in the SDK into your Android or iOS app and start tracking. We only collect location data on device when startTracking() method of SDK is called. Hence it is important to integrate our SDK and call startTracking() method in order for geofences to trigger. You can follow the iOS or Android guide to get started.

Step 2: Create a Geofence on our API

Follow the guides here to create a Geofence.

Step 3: Setup webhook or slack endpoint to receive notification.

Every time a Geofence rule is satisfied we create an event with all the details of when and how the Geofence was triggered. You can receive these Events on your server via webhooks or a communication platform like Slack.

Step 4: Receive webhook event or Slack alert

You can see the sample slack alert and sample webhook event that will be sent to your configured endpoints.

  • Sample slack alert Slack Alert
  • Sample webhook event
{
   "id":"33805909-4ad3-4e2d-a7b7-664950516717",
   "user_id":"4ff08c6e-c19f-4326-9fc4-cdb701560eb2",
   "recorded_at":"2017-07-19T16:26:36.932000Z",
   "type":"geofence.location.entered",
   "data":{
      "object":{
         "id":"a63c7a2b-a199-4ada-9f60-3a87f1a09b26",
         "user":{
            "id":"4ff08c6e-c19f-4326-9fc4-cdb701560eb2",
            "group_id":"4d5ea9bf-6bb0-42e0-9c42-76cf048d102b",
            "lookup_id":"+91 97012 17766_7624b991b6efa1f6",
            "name":"Piyush Gupta",
            "phone":"+91 97012 17766",
            "photo":"https://core-api-prod-assets.s3.amazonaws.com/uploads/photos/drivers/driver_d85e7d7f-d943-4f99-89c8-6a5b70c61b25_image_name",
            "availability_status":"online",
            "vehicle_type":"unknown",
            "pending_actions":[

            ],
            "last_location":{
               "activity_confidence":77,
               "activity":"stationary",
               "provider":"non_gps",
               "geojson":{
                  "type":"Point",
                  "coordinates":[
                     77.1840239,
                     28.702284
                  ]
               },
               "recorded_at":"2017-07-19T18:43:37.332000+00:00",
               "accuracy":22.07
            },
            "last_online_at":"2017-07-17T05:15:45.223000Z",
            "last_heartbeat_at":"2017-07-19T19:26:47.837405Z",
            "last_battery":32,
            "location_status":"location_available",
            "display":{
               "sub_status_text":"Last updated an hour ago",
               "seconds_elapsed_since_last_heartbeat":3996.520403,
               "battery":32,
               "has_new_sdk":true,
               "status_text":"Network offline",
               "speed":null,
               "is_warning":true
            },
            "created_at":"2017-05-06T08:50:47.172408Z",
            "modified_at":"2017-07-19T19:26:47.853766Z",
            "is_connected":false
         },
         "type":"location.entered",
         "geofence":{
            "id":"f5aa267e-bea5-43ed-9961-ba41b0b856ad",
            "user_id":"4ff08c6e-c19f-4326-9fc4-cdb701560eb2",
            "type":"location",
            "place":{
               "id":"d2ecda24-af0f-43dd-8306-ed2d7e9708f7",
               "name":"",
               "location":{
                  "type":"Point",
                  "coordinates":[
                     77.1838082,
                     28.7020039
                  ]
               },
               "address":"C33, Block C, Mahendru Enclave, Gujranwala Town, Delhi",
               "locality":"Gujranwala Town",
               "landmark":"",
               "zip_code":"",
               "city":"",
               "state":"",
               "country":""
            },
            "min_duration":null,
            "max_duration":null,
            "expire_at":"2017-08-18T11:23:27.636883Z"
         },
         "stop":{
            "id":"6e67a59b-76e2-48db-a282-9b16fd880e2c",
            "user_id":"4ff08c6e-c19f-4326-9fc4-cdb701560eb2",
            "place":{
               "id":"4c76bd8c-c9bf-47b9-8026-a14f564365bd",
               "name":"",
               "location":{
                  "type":"Point",
                  "coordinates":[
                     77.1841587,
                     28.7021626
                  ]
               },
               "address":"C33, Block C, Mahendru Enclave, Gujranwala Town, Delhi, 110009, India",
               "locality":"Gujranwala Town",
               "landmark":"",
               "zip_code":"110009",
               "city":"Delhi",
               "state":"DL",
               "country":"IN"
            },
            "started_at":"2017-07-19T16:26:36.932000Z",
            "ended_at":null,
            "duration":10810.905405,
            "location":{
               "activity_confidence":100,
               "activity":"stationary",
               "provider":"non_gps",
               "geojson":{
                  "type":"Point",
                  "coordinates":[
                     77.1842261,
                     28.7021466
                  ]
               },
               "recorded_at":"2017-07-19T16:24:59.729000+00:00",
               "accuracy":22.605
            },
            "lookup_id":"a679394a-5631-4315-b8aa-22b090d68c45",
            "step_count":null,
            "step_distance":null,
            "created_at":"2017-07-19T16:31:28.825716Z",
            "modified_at":"2017-07-19T16:31:28.825743Z"
         },
         "triggered_at":"2017-07-19T16:26:36.932000Z"
      }
   },
   "created_at":"2017-07-19T16:31:28.893174Z",
   "trigger_count":3
}

Step 5: Stop tracking (optional)

Use the HyperTrack.stopTracking() method in the SDK, in case you want to stop tracking at any point. This will stop collecting data on device and will effectively disable the Geofence until you call HyperTrack.startTracking() again.

results matching ""

    No results matching ""