Tasks in your workflow

A Task is a transaction event that is performed by the Driver. In a typical lifecycle, Tasks are created, assigned to Drivers, and then completed.

Tasks add your business context to a Driver's trip. Tasks can represent pickups, or sales visits, depending on your use-case. The dashboard will show detailed task statuses, updated in real-time, and for historical analyses. Tasks can also be live tracked on a map view by your customers.

This guide covers the basic lifecycle of Tasks, and how you can use it in the lifecycle of your application.

Task timeline

Step 1: Create a Driver

The Driver entity represents who is being tracked while performing the Task. Use this API will create and return a Driver object. Once created, the Driver objects can be reused for assigning tasks.

HTTP Request

POST https://app.hypertrack.io/api/v1/drivers/ (more info)

[info] Driver id

It is recommended to store the driver id in your database table of the related entity. You can use this id to assign tasks, and also fetch driver statistics.

curl -H "Authorization: token YOUR_SK_TOKEN" \
     -H "Content-Type: application/json" \
     -X POST \
     -d "{\"name\": \"Driver name\", \"vehicle_type\": \"car\", \"phone\": \"+16502469293\"}" \
     https://app.hypertrack.io/api/v1/drivers/

Step 2: Create a Task

In your app when you create a transaction, like an order or a sales visit, create a corresponding Task object. You can specify the destination and the ETA committed to your customer, to get delay alerts.

HTTP Request

POST https://app.hypertrack.io/api/v1/tasks/ (more info)

curl -H "Authorization: token YOUR_SK_TOKEN" \
     -H "Content-Type: application/json" \
     -X POST \
     -d "{\"destination_id\": \"f3ead2ae-dc0a-4a7e-85be-74ee51d9d70a\", \"committed_eta\": \"2016-03-09T07:00:00.00Z\"}" \
     https://app.hypertrack.io/api/v1/tasks/

Step 3: Assign a Task to a Driver

This API will assign a list of Tasks to a Driver. You can use this API in your application when the job is dispatched, and you want to start tracking the Driver.

The API can also be called multiple times to assign more Tasks. If driver is on a Trip when the call is made, we add these tasks to the live Trip, or else we create a new Trip. Read more about Trips with Tasks.

[info] Billing

Assigning a Task is a paid operation, and will use your billing credits. A Task which is created but not assigned is not charged.

HTTP Request

POST https://app.hypertrack.io/api/v1/drivers/<id>/assign_tasks/ (more info)

curl -H "Authorization: token YOUR_SK_TOKEN" \
     -H "Content-Type: application/json" \
     -X POST \
     -d "{\"task_ids\": [\"6daacb03-6f02-4c60-b084-e9ffcd9eaf56\", \"37ae09b4-4801-48cb-bc50-99a7ee53f257\"]}" \
     https://app.hypertrack.io/api/v1/drivers/d0ae4912-2074-45ef-a7c0-76be58639ea9/assign_tasks/

[warning] SDK integration

For the assign task to trigger the SDK to start sending location data, the SDK needs to be connected with the driver id. Once the SDK is connected, the assign tasks API automatically triggers the SDK to start tracking. Read more about in the SDKs section.

Step 4: Complete a Task

When the transaction is completed, marked the Task object as completed. When all tasks are marked completed, we end the Trip and stop tracking.

HTTP Request

POST https://app.hypertrack.io/api/v1/tasks/<id>/completed/ (more info)

curl -H "Authorization: token YOUR_SK_TOKEN" \
     -H "Content-Type: application/json" \
     -X POST \
     https://app.hypertrack.io/api/v1/tasks/77b9a3fa-a3ab-4840-aadb-cd33442ca45b/completed/

[success] Tasks lifecycle

In this guide, we covered the Driver and Task entity, and learnt how a job can be assigned to a Driver. When a Driver is performing a Task, a live tracking experience can be embedded in the customer app. Read the next guide to implement live tracking in your app.

results matching ""

    No results matching ""