Skip to main content

Webhooks

Setting up webhooks with eLogii

eLogii avatar
Written by eLogii
Updated over 2 weeks ago

A webhook is a way for eLogii to send real-time data to an external server when a specific event happens, such as tracking information.

It can be set up in Configuration Webhooks.

Select the webhook type and enter the endpoint to which the content will be sent, and click Add a webhook.

Our entire webhook documentation can be viewed by selecting Show Webhook Documentation.

There are two kinds of webhooks you can make: one is for the entire organization, and the other is for the Customer entity.

Organization-level Webhooks

Organization-level Webhooks apply to Routes, Tasks, Task templates, and Optimization.

Users can pick any of the available Webhook types (taskUpdate, taskStateUpdate, optimization, etc.), Request type (POST, GET, PUT, DELETE), Authentication (None, Basic HTTP Auth, Header/API key, HMAC, OAuth 2.0 - Client Credentials), Trigger condition (This field is used to trigger a hook only when specific conditions are met, for example, when the task size exceeds 100. If you're not sure how to configure this, please contact eLogii support for assistance), Fields (the fields you want to use for the webhook), and if they wish for the webhook to Auto retry.

Depending on the Authentication of choice, the required options may vary.

Once your setup is done, click +Add to save your webhook.

Customer-level Webhooks

Customer-level webhooks affect Route, Task, Task templates, and Optimization data related to a specific Customer.

Users need to specify which Customer the webhook will relate to and populate the other fields accordingly. The available fields are identical to the ones in Organization-level Webhooks.

Once your setup is done, click +Add to save your webhook.

Webhook Types

The most triggered hook types are task update, routeETAupdate, and route updated webhooks. Setting up a trigger condition is important to reduce server overload and network traffic, resulting in high costs.

Setting up the trigger condition

The trigger condition is used to trigger a hook under certain conditions, which has a syntax similar to an API request payload. E.g., if you'd like to only receive hook requests that have the state as completed, you should enter {"state": 60}. It sends a webhook request once the task's state changes to completed from another state.

The fields component can be used to filter the parameters you need in the hook request body. This allows you to only receive the necessary fields you need.

The auto try can be toggled on to ensure the system retries sending another webhook request if the previous hook failed.

Task state update webhook

This webhook is sent when the task's state changes. E.g., when a task is initially created or when it moves from created to pickup en route.

{"_id":"6819057c9aa0d325f78bb9d4","uid":"T-CTCUK0NT","state":0,"stateText":"Created","stateTimestamp":1746470268,"history":[{"data":{"state":0,"stateText":"Created"},"actor":{"userId":"63564f85c557c10012661e40","userLevel":"20","action":"Tasks.create","email":"test@gmail.com"},"timestamp":"2025-05-05T18:37:48.485Z"}],"organization":"63564f85c557c10012661e3e","tags":[],"timestamp":"2025-05-05T18:37:48.505Z","actor":{"userId":"63564f85c557c10012661e40","userLevel":"20","action":"Tasks.create","email":"test@gmail.com"},"hookType":"taskStateUpdate"}

Task Update Webhook

This webhook is sent whenever a task is updated. An update can be creating a task, changing a particular field, manually reordering a task, optimizing tasks, or manually assigning/unassigning a task. The updated data can be found in the history array object as a data object.

{"_id":"6819057c9aa0d325f78bb9d4","uid":"T-CTCUK0NT","previousState":0,"previousStateText":"Created","state":0,"stateText":"Created","history":[{"data":{"state":0,"stateText":"Created"},"actor":{"userId":"63564f85c557c10012661e40","userLevel":"20","action":"Tasks.create","email":"test@gmail.com"},"timestamp":"2025-05-05T18:37:48.485Z"},{"data":{"dateRange":null,"pickup":{"timeWindows":[]},"dateTimeWindows":[{"date":20250505}],"timeWindows":[],"date":20250505},"actor":{"userId":"63564f85c557c10012661e40","userLevel":"20","action":"Tasks.update","email":"test@gmail.com"},"timestamp":"2025-05-05T18:43:05.816Z"}],"organization":"63564f85c557c10012661e3e","tags":[],"timestamp":"2025-05-05T18:43:05.835Z","actor":{"userId":"63564f85c557c10012661e40","userLevel":"20","action":"Tasks.update","email":"test@gmail.com"},"hookType":"taskUpdate","action":"Tasks.update"}

Task Assignment Update Webhook

This webhook is sent when a task is assigned or unassigned to a route. This hook is triggered by an optimization or manual action.

{ "_id": "6818619567b4723605ab1129", "uid": "T-EOPIY3S0", "reference": "Ref123445", "previousAssignment": { "state": 0 }, "assignment": { "state": 20, "assignee": { "model": "Driver", "_id": "679b72f1c3887798c11ec920", "info": { "_id": "679b72f1c3887798c11ec920", "uid": "DR-Y59AEXUN", "firstName": "Driver - ", "lastName": "1", "mobile": "1738240753109", "skills": [], "vehicleInfo": { "_id": "679b72f0c3887798c11ec875", "uid": "V-P7Y27VB9", "name": "Vehicle 1", "vehicleType": "679b72f0c3887798c11ec86d", "category": null, "capacity": { "Containers": 1200 }, "capabilities": [ "Contains fridge", "2" ], "cost": { "perHour": [], "perDay": [], "perKM": [] }, "vehicleTypeUID": "VT-M2858UZO", "vehicleTypeName": "Test Type" }, "cost": { "perHour": [], "perDay": [] }, "teams": [], "flags": { "isExcludedFromOpti": false, "isAutoOptiDisabled": false, "isRouteETADisabled": false, "isAutoRoutingDisabled": false, "isUnconstrained": false, "isBusy": false, "isAccountDisabled": false, "isTestDriver": false, "hasAvatar": false, "isAvatarAwaitingApproval": false }, "startLocation": { "type": 0, "uid": "DEP-IZWWK2T7", "_id": "679b72f0c3887798c11ec86a", "name": "Test Depot 0", "address": "201-202 Sloane Street", "postCode": "SW1X 9QX", "city": "London", "country": "United Kingdom", "coordinates": [ -0.159753878786041, 51.5007111348899 ] }, "endLocation": { "type": 2, "address": "35b Eve Road", "postCode": "GU21 5JS", "city": "Woking", "country": "England", "coordinates": [ -0.5407759, 51.326414 ] } } }, "route": "6818a081deaaf6c9b77b7267", "routeUID": "RT-250505-417209", "routeOrderPickup": null, "routeOrder": null }, "estimates": { "date": 20250505 }, "organization": "63564f85c557c10012661e3e", "tags": [], "timestamp": "2025-05-05T19:53:12.752Z", "actor": { "userId": "63564f85c557c10012661e40", "userLevel": "20", "action": "Tasks.assignManually", "email": "test@gmail.com" }, "hookType": "taskAssignmentUpdate", "action": "Tasks.assignManually" }

Optimization Webhook

This hook is sent whenever the optimization is run.

Please note that the payload for this hook and the route webhooks are very long, so you need to filter the fields you need.

Route ETA update Webhook

The route ETA update hook is sent each time the ETA is updated, usually automatically or by a reoptimization action.

Route Created Webhook

This hook is sent whenever a new route is created during optimization or by manual assignment.

Route Updated Webhook

This hook is sent when there is any action performed on a route, like automatic ETA updates, optimization, or manual route actions.

Route Completed Webhook

This hook is sent when all the tasks on a route are in a final state such as completed or failed state.

Route removed Webhook

This hook is sent when all tasks are unassigned from a route either by the optimization or by manually clearing the route or unassigning all tasks.

{"_id":"6819d4d712e0132e679a4e05","uid":"RT-250506-971025","organization":"564f85c557c10012661e3efff","assignee":{"model":"Driver","_id":"679b72f2c3887798c11ec94e","info":{"_id":"679b72f2c3887798c11ec94e","uid":"DR-X4QRBMC3","firstName":"Driver - ","lastName":"6","mobile":"1738240753109","skills":[],"vehicleInfo":{"_id":"679b72f0c3887798c11ec88a","uid":"V-1SRXJWQI","name":"Vehicle 6","vehicleType":"679b72f0c3887798c11ec86d","category":null,"capacity":{"Containers":1200},"capabilities":["8"],"cost":{"perHour":[],"perDay":[],"perKM":[]},"vehicleTypeUID":"VT-M2858UZO","vehicleTypeName":"Test Type"},"cost":{"perHour":[],"perDay":[]},"teams":[],"flags":{"isExcludedFromOpti":false,"isAutoOptiDisabled":false,"isRouteETADisabled":false,"isAutoRoutingDisabled":false,"isUnconstrained":false,"isBusy":false,"isAccountDisabled":false,"isTestDriver":false,"hasAvatar":false,"isAvatarAwaitingApproval":false},"startLocation":{"_id":"679b72f0c3887798c11ec86a","type":0,"uid":"DEP-IZWWK2T7","organization":"63564f85c557c10012661e3e","path":"63564f85c557c10012661e3e","name":"Test Depot 0","teams":[],"address":"201-202 Sloane Street","postCode":"SW1X 9QX","city":"London","country":"United Kingdom","coordinates":[-0.159753878786041,51.5007111348899],"schedule":[],"demo":true,"createdAt":"2025-01-30T12:39:12.449Z","updatedAt":"2025-01-30T12:39:12.449Z","__v":0},"endLocation":{"_id":"679b72f0c3887798c11ec86a","type":0,"uid":"DEP-IZWWK2T7","organization":"63564f85c557c10012661e3e","path":"63564f85c557c10012661e3e","name":"Test Depot 0","teams":[],"address":"201-202 Sloane Street","postCode":"SW1X 9QX","city":"London","country":"United Kingdom","coordinates":[-0.159753878786041,51.5007111348899],"schedule":[],"demo":true,"createdAt":"2025-01-30T12:39:12.449Z","updatedAt":"2025-01-30T12:39:12.449Z","__v":0}}},"teams":[],"date":20250506,"dateTimeWindows":[{"date":20250506}],"timestamp":"2025-05-06T09:24:40.935Z","hookType":"routeRemoved"}

Zone Updated Webhook

This hook is sent when an update is made on any zone.

{"_id":"6819d6399aa0d325f78d7a30","uid":"ZONE-LSTZ8PGY","organization":"564f85c557c10012661e3e","path":"564f85c557c10012661e3e","order":2,"name":"Zone 3","active":true,"tags":[],"geoJSON":{"type":"Feature","properties":{},"geometry":{"coordinates":[[[-0.28564371372570463,52.74644699670165],[-0.07966676793589045,52.47009558926092],[-0.533673118744673,52.30991326219785],[-0.7515510595852106,52.57542048189555],[-0.28564371372570463,52.74644699670165]]],"type":"Polygon"}},"createdAt":"2025-05-06T09:28:25.834Z","updatedAt":"2025-05-06T09:28:54.570Z","__v":0,"timestamp":"2025-05-06T09:28:54.584Z","hookType":"zoneUpdated"}

Import Completed

This hook is sent immediately after a file has been imported into the system.

Task Template Created

This hook is sent when a task template is newly created.

Task Template Updated

This hook is sent when there is any update on a task template parameter, such as scheduling/removing for a period, or if the template is deactivated/activated.

Task Template Removed

This hook is sent when a task template is removed from the system via the dashboard or API.

{"_id":"6819d7b875b8fd45ee24d004","organization":"564f85c557c10012661e3e","template":{"taskTemplateGroup":{"_id":"6819d7b875b8fd45ee24d000","uid":"TTG-RDL0K05L"},"task":{"_id":"6814d0480910200039219055","uid":"T-244HKXA9"}},"timestamp":"2025-05-06T09:43:23.134Z","hookType":"TaskTemplate.removed"}

Did this answer your question?