Automate logistics flow with live location

Automate logistics flow with live location

Mobile apps are driving the digital transformation of logistics. A modern workforce automation or fleet automation solution must have a mobile app for drivers as they are out and about performing their deliveries or service visits.

In this tutorial, we consider a logistics business that has fleet managers and their teams consisting of app users such as, for example, delivery riders, service technicians, or sales people.

These app users are expected to visit locations for the duration of their work shift. In their logistics app, they receive a list of delivery orders in the app with details with addresses for their delivery destinations.

We will go through the following steps in this tutorial:

Define delivery locations

With geofences for each delivery destination address, you start enabling fleet managers automate logistics with live location of their app users.

Live location tracking automatically triggers visit arrival and exit events, with real-time notifications posted to your logistics app backend. Each geofence entry and exit event provides inside into time spent at each geofence as well as distance and duration of travel between geofence visits for each app user.

For each work shift, you will create geofences for each delivery location your app users are expected to visit. HyperTrack provides Geofences API to achieve this goal.

You can create:

  • geofences for delivery visit locations either for all app users in the fleet or
  • create such geofences for each app user.

Create geofences for the entire fleet

In the logistics app workflow where you may have a number of pre-defined delivery locations for an entire team, you may go ahead to create geofences for all app users.

You can use this Geofences POST API to create a geofence as shown in an example below. Note that you may pass an array of geofence definitions in one API call at once.

POST   https://v3.api.hypertrack.com/geofences


curl -X POST \
-u {AccountId}:{SecretKey} \
https://v3.api.hypertrack.com/geofences

For example, in the payload below, you are creating two geofences all devices under your account. Your account is automatically identified through your AccountId credential supplied in the API call.

{
"geofences": [
{
"geometry": {
"type": "Point",
"coordinates": [ 122.395223, 37.7947633]
},
"metadata": {
"station": "A"
},
"radius": 50
},
{
"geometry": {
"type": "Point",
"coordinates": [ 122.394221, 37.7937921]
},
"metadata": {
"station": "B"
},
"radius": 50
}
]
}

Once the call is made successfully, you will get back an HTTP 200 response with this example payload below. Your logistics app backend must store a map in your database between the delivery destination and geofence_id returned in the API call.

[
{
"geometry":{
"type":"Point",
"coordinates": [
122.395223, 37.7947633
]
},
"metadata":{
"station": "A"
},
"radius":50,
"single_use": false,
"geofence_id":"000111-4047-4b28-a6ec-f934e870c425"
},
{
"geometry":{
"type":"Point",
"coordinates": [
122.394221, 37.7937921
]
},
"metadata":{
"station": "B"
},
"radius":50,
"single_use": false,
"geofence_id":"0002223047-3b28-a8ec-e934e870c515"
}
]

Create geofences for logistic app user

In a business use case where each logistics app user is expected to visit locations only assigned to him/her, create geofences for each app user. You will have identified each app user by device_id as described below.

POST   https://v3.api.hypertrack.com/geofences

In the payload below, you will notice device_id where we are creating two visit locations geofences for device F3DF6D4F-6A06-4883-8201-D767EA408030.

{
"device_id": "F3DF6D4F-6A06-4883-8201-D767EA408030",
"geofences": [
{
"geometry": {
"type": "Point",
"coordinates": [ 122.395223, 37.7947633]
},
"metadata": {
"station": "A"
},
"radius": 50
},
{
"geometry": {
"type": "Point",
"coordinates": [ 122.394221, 37.7937921]
},
"metadata": {
"station": "B"
},
"radius": 50
}
]
}

Once the call is made successfully, you will get back an HTTP 200 response whrere you will get geofence_id for each destination. Make a note of geofence_id returned below as you will need it to delete this geofence once the user is done for the day.

Integrate live location in your logistics app

To add location-based automation to your logistics solution, you must add the HyperTrack SDK to your logistics app user app. Please use one of the following options.

Enable location tracking in logistics app

Follow these instructions to install the SDK.

What if I do not have my own app yet?

Don’t have a logistics app yet? No problem.

You can get started with HyperTrack Logistics App on Android in PlayMarket and iOS in AppStore. These apps are open sourced and available on GitHub.

To make customizations to the apps, you can fork their repositories on both Android and iOS and re-use the code to build your own logistics app.

Identify app users

In order to identify app users in your logistics app, you must add device metadata for each app user and use device_id generated by HyperTrack SDK. Store device_id in your logistics app backend along with the user credentials in your user management database.

You will be able to use device metadata to filter and create dedicated team dashboards. This would help you filter the views and restrict for each team and their fleet manager.

Review instructions on how to set device name and metadata and make a decision on what works best for your logistics app.

For example, the device name can be a phone number or some other identifier you use in your system with example metadata below:

{
"name": "+14150000000",
"metadata": {
"driver_id": "Charles_I"
"city": "San Francisco",
"team_id": "TEAM_A"
}
}

These metadata attributes can be useful to identify and filter selected logistics app riders in the dashboard.

Add in-app feature to make visit notes

As the app user gets done with a delivery, the user can mark a delivery done in the app.

You can use HyperTrack SDK method to send a geotag from the logistics app to HyperTrack platform.

Additionally, HyperTrack will generate route time and distance information in webhook notifications for each triggered geotag as explained in this section.

For example, your mobile logistics app can send this meta-data upon a delivery event manually triggered by an app user:

{
"product_id": "Water Filter",
"action": "delivered",
"quantity": 5,
"customer_name": "Thomas R"
}

Track deliveries

As your app user performs delivery visits throughout the work shift, HyperTrack automatically detects geofence entry and exits.

You can receive geofence visits entry and exit events in real-time in your logistics app backend and integrate in your business workflow.

For example, you may store geofence visit locations for reporting and proof of delivery. You may use these events to send visual notifications to the app user and automatically update their delivery status.

Additionally, in real-time, you receive time spent at each visit, actual route from one visit geofence to another which includes duration and distance, as well as real-time app user status including stops and their durations that may be made between their assigned visit locations.

Integrate webhook notifications

HyperTrack provides webhooks integration to send you geofence visit status as well as visit notes sent as geotags from your HyperTrack SDK integration.

Webhook payload is expected to have the following data structure to represent geofence enter and exit events and as well as a geotag event as shown in an example below:

[
{
"created_at": "2019-07-01T14:01:00.000000Z",
"recorded_at": "2019-07-01T14:00:00.000000Z",
'data': {
'value': 'enter',
'geofence_metadata': {
"station": "B"
}
"route_to":{
"distance": 238,
"duration": 63,
"from": {
"geofence_id": "0002223047-3b28-a8ec-e934e870c515",
},
"markers": [
],
"locations": [
]
}
},
"location": {
"type": "Point",
"coordinates": [
122.394221, 37.7937921
]
},
"device_id": "F3DF6D4F-6A06-4883-8201-D767EA408030",
"type": "geofence",
"version": "2.0.0"
},
{
"created_at": "2019-07-01T14:01:00.000000Z",
"recorded_at": "2019-07-01T14:00:00.000000Z",
"data": {
"metadata": {
"product_id": "Water Filter",
"action": "delivered",
"quantity": 5,
"customer_name": "Thomas R"
},
"route_to":{
"distance": 238,
"duration": 63,
"start_location": {
"geometry": {
"coordinates": [
122.392239, 37.7917942
]
"type": "Point"
},
"recorded_at": "2019-07-01T13:52:08.213000Z"
}
}
},
"location": {
"type": "Point",
"coordinates": [
122.394228, 37.7937925
]
},
"device_id": "F3DF6D4F-6A06-4883-8201-D767EA408030",
"type": "custom_marker",
"version": "2.0.0"
}
]

In the example, you can see that device_id with value F3DF6D4F-6A06-4883-8201-D767EA408030 an automatically triggered geofence event as well as an app visit note that was triggered by the app user's action from the mobile logistics app.

For further reference, you may visit this guide to receive and process geofence visit events.

Verify actual visit location

With the example above, logistics app user can trigger a visit note with a geotag to be sent from the app.

HyperTrack will process the geotag event and attach location associated with the marker in the webhook update payload. The geotag webhook payload contains the location as shared above in the dictionary with type custom_marker.

This data can be used to verify accurate location of the user action triggered during the visit.

Create fleet ops dashboards and leaderboard

Fleet managers and teams can track app user's live location, location history and deliveries in their dashboard through embeddable HyperTrack Views. Fleet managers get access to delivery notes and pictures in the map to drill down more efficiently.

Leaderboards may be used to track the app user's productivity, efficiency, and their behavior, and export reports as CSV.

Embeddable hierarchical dashboard integration

As explained in embed hirerchical views guide HyperTrack enables you to create embedded real-time delivery tracking in your logistics app operations dashboard. To build such a dashboard, you use inline frames to quickly embed real-time dashboard built by HyperTrack in your application.

Create fleet manager dashboards

Fleet managers can use a real-time dashboard to view all app user locations and deliveries for the day in real-time.

Location Map


Create fleet manager dashboard for all logistics app users in your account

Use device metadata to create a fleet manager dashboard to track all delivery riders.

For example:

https://embed.hypertrack.com/devices?publishable_key={publishable_key}

Create fleet manager dashboard for selected logistics app users

Use device metadata to create fleet manager dashboard for a selected set of app users. As mentioned you can leverage app user metadata to identify a team and show their real-time location in the dashboard.

https://embed.hypertrack.com/devices?publishable_key={publishable_key}&metadata_filter=%7B%22team_id%22%3D%22%7Bteam_id_value%7D%22%7D

Create single delivery rider real-time dashboard

For example, you may want to create a real-time dashboard to show location and delivery status for an app user identified by a device_id as shown below:

https://embed.hypertrack.com/devices/{device_id}?publishable_key={publishable_key}

geofences embed view

In the image above, you can see gray dots representing geofences created while blue dots show geofences visited by the app user. Once you click on either gray or blue dots, you may see geofence metadata created exactly as defined via Geofences API.

Create and embed logistics app user leaderboard

Use HyperTrack embeddable daily overview leaderboard to let fleet managers review scores and metrics for their teams of logistics app users.

The leaderboard shows your app users ranked by our tracking score, a composite score based on trip, geotag and geofence behavior, and tracking percentage.

https://embed.hypertrack.com/leaderboard?publishable_key={publishable_key}

Location Map

With this leaderboard integration, you enable fleet managers export leaderboard data via a CSV file export.

Summary: Automate logistics workflow with HyperTrack

In summary, your logistics app will work with HyperTrack as follows:

Location Map

  1. An app user checks in the logistics app. The app user will have assigned list of destinations to visit as defined by your operations manager in your logistics app backend.
  2. Your logistics app backend creates geofences for your app user with Geofences API. These geofences define locations you expect your user to visit for the duration of the work shift. Next, start app user's device location tracking once you expect the user to start her work shift. Use Devices API to start tracking on the app user's device.
  3. As your app user performs deliveries, HyperTrack sends webhook notifications for each geofence entry and exit events to your server.
  4. Optionally, you may use the webhook notifications to send visible push notifications to your app user's device to notify the user about status of geofence visits.
  5. To send delivery notes, use SDK method to send geotags to the HyperTrack platform.
  6. Once the app user is done for the day, check out is performed.
  7. In your logistics app backend, take an opportunity to delete geofences created for the user and stop tracking on the app user's device.
important

Once your app user checks out for the day, your logistics app backend will need to stop location tracking on your app user's device with Devices API.

Sample apps for logistics automation

If you do not yet have an app and want to start automating your logistics without building an app, you can immediately deploy HyperTrack Logistics app from app stores on Android and iOS and get started right away.

Download HyperTrack Logistics app

From your dashboard Apps Page you can add drivers on your fleet via Invite button under "Logistics" app. One this button is pressed, click Copy link under Share invite link.

This will allow you to send an invitation a deep link to download HyperTrack Logistics app to your drivers in your fleet. Once they download and install the app, they get automatically added to your account and you can immediately start automating your fleet logistics with HyperTrack Geofences API.

         

Build new app

HyperTrack Logistics app is also available as an open source for you to fork or clone to start developing your own logistics app.

This approach is best for product development teams who are starting to build an app for their business and want to kickstart with an open sourced app built with HyperTrack. Start development by forking or cloning Logistics app GitHub repos on Android or iOS.

                   

Questions?

If your have requirements to increase operational efficiency of your business assets by tracking arrivals and exits at important areas for your business, questions or comments on any of the topics above, please do not hesitate to contact us.

Is this page useful?