Webhooks

Webhooks

Webhooks make it possible for your application to be notified of important system events, as soon as these take place within Onfleet.

While you are generally able to create as many webhook entries as you'd like, remember that a single webhook always targets a single trigger. The following triggers are available:

ID

Name

Description

Includes

Limitations

0

taskStarted

Task started by worker.

taskId, data.task

None

1

taskEta

Worker ETA less than or equal to threshold value provided, in seconds.

taskId, data.task, etaSeconds

Limit of 10 webhooks. Each will fire once per task, at most once every 30 seconds, when threshold is met.

2

taskArrival

Worker arriving, at or closer than threshold value provided, in meters.

taskId, data.task, distance

Limit of 10 webhooks. Each will fire once per task, at most once every 30 seconds, when threshold is met.

3

taskCompleted

Task marked as successful.

taskId, data.task

Task cannot be both successful and failed.

4

taskFailed

Task failed.

taskId, data.task

Task cannot be both successful and failed.

5

workerDuty

Worker status changed (0 for off-duty, 1 for on-duty).

workerId, status, data.worker

None

6

taskCreated

New task created.

taskId, data.task

Does not include tasks created via task import from the Onfleet dashboard.

7

taskUpdated

Task updated, including:

Updated completionDetails (including distance, location, added timestamps, added completion/failure notes)

When attachment ids are received under completionDetails field (This includes signature, photos)

Recipient feedback has been received(when feedback field is updated)

taskId, data.task

None

8

taskDeleted

Task deleted.

taskId, data.task

None

9

taskAssigned

Task assigned to worker.

taskId, data.task

This webhook will only be triggered when a Task is assigned to different containers (organization, worker, team). However, when a task is assigned during creation, it will not trigger a change of assignment as the task is just created with a direct assignment.

10

taskUnassigned

Task unassigned from worker.

taskId, data.task

None

12

taskDelayed

Task is delay time is greater than or equal to threshold value provided, in seconds.

taskId, data.task, delay

Limit of 10 webhooks, applies only to active tasks, will only fire once. Only sent for active tasks.

13

taskCloned

Task cloned via dashboard or API. Note that the taskCreated trigger will not fire when a task is cloned.

taskId, data.task

None

14

smsRecipientResponseMissed

Recipient responds to a notification via SMS, but the organization is unable to handle it at that time.

from, to, body

None

15

workerCreated

A new worker has been created.

adminId, workerId, actionContext , triggerId,triggerName, taskId,data.worker, time

None

16

workerDeleted

A worker has been deleted.

adminId, workerId, actionContext , triggerId,triggerName, taskId,data.worker, time

None.

17

SMSRecipientOptOut

When a recipient replied "STOP" to opt out of SMS communications.

recipient, timestamp, SMS, triggerId, triggerName,time

None.

18

autoDispatchJobCompleted

When Team Auto-Dispatch calculation is completed.

actionContext, adminId, data.dispatch, dispatchId, taskId, time, triggerId, triggerName, workerId

None.

19

taskBatchCreateJobCompleted

When Async Batch Tasks creation is completed.

status, tasksReceived, tasksCreated, tasksErrored, errors[], failedTasks[], newTasks[], newTasksWithWarnings[], workerId, adminId, taskId, actionContext, time, data

None.

20

routeOptimizationJobCompleted

When Route Optimization is completed

actionContext, triggerId, triggerName, taskId, workerId, adminId, data, dispatchId, time

22

routePlanCreated

When a Route plan is created

actionContext, triggerId, triggerName, adminId, routePlanId, data.routePlan, workerId, data.worker, time

23

routePlanStarted

When a Route plan is started

actionContext, triggerId, triggerName, adminId, routePlanId, data.routePlan, workerId, data.worker, time

24

routePlanCompleted

When a Route plan completed

actionContext, triggerId, triggerName, adminId, routePlanId, data.routePlan, workerId, data.worker, time

25

workerUpdated

When a worker information is updated

workerId, actionContext, triggerId, triggerName,adminId, taskId, data, time

26

routePlanUpdated

When a Route plan is changed

actionContext, triggerId, triggerName, adminId, routePlanId, data.routePlan, workerId, data.worker, time

27

routePlanUnassigned

When a Route Plan is unassigned

actionContext, triggerId, triggerName, adminId, routePlanId, data.routePlan, workerId, data.worker, time

28

routePlanAssigned

When a Route Plan is assigned

actionContext, triggerId, triggerName, adminId, routePlanId, data.routePlan, workerId, data.worker, time

29

routePlanDelayed

When a Route Plan is marked as delayed

actionContext, triggerId, triggerName, adminId, routePlanId, time

30

predictedTaskDelay

Predicted task is delay time is greater than or equal to threshold value provided, in seconds.

taskId, actionContext, triggerId, triggerName, workerId,data.task, data.task.delayTime, time

Will be sent for tasks in an "assigned" state. Note that this is evaluated when tasks in the driver's queue are started, and messages will be sent at this point.

Webhooks can be maintained via dashboard or API. All standard, non-validation requests from Onfleet to you are made via POST.

In addition to the properties from the Includes column above, the JSON body we will POST to your url will include a time property along with triggerId and triggerName so you may overload the same url on your application as required. In addition, full objects will be provided in the data property, as relevant. Note that all other properties not relevant to the trigger may be provided as null.

🚧

Unix Precision

All time data fields returned are in milliseconds precision, with the exception of etaSeconds, which is in seconds.