Subscriptions are similar to webhooks except that with subscriptions you specify which 'entities' and event types you want to subscribe to. It is much more granular and flexible.
Two different 'entities' are available for you to subscribe to: Account and RoutePlan. You may have multiple subscriptions across those entities.
Account entities will trigger the subscription for every order or invoice of that account that match the registered event types.
RoutePlan entities will trigger the subscription for every route of that route plan that match the registered event types.
Possible event types for orders subscriptions are:
- order_created
- order_dispatched
- order_assigned
- order_picked_up
- driver_unassigned
- driver_arrived_at_pickup
- driver_arrived_at_delivery
- order_delivered
- order_cancelled
- order_on_hold
- order_released
- pickup_from_time_updated
- delivery_time_window_updated
- proof_of_delivery_added
Possible event types for invoice subscriptions are:
- invoice_completed
- invoice_cancelled
Possible event types for route plan subscriptions are:
- route_created
- route_assigned_to_order
- route_unassigned_from_order
- driver_allocated_to_route
- driver_deallocated_from_route
- route_dispatched
- route_status_changed
- route_deleted
Examples
Request payload for creating an order subscription for when an order is created and delivered, for account ABC:
{
"EntityType": "Account",
"EntityId": "ABC",
"Url": "https://my-order-webhook.com",
"EventTypes": [
"order_created",
"order_delivered"
]
}
Request payload for creating an invoice subscription for when an invoice is completed, for account ABC:
{
"EntityType": "Account",
"EntityId": "ABC",
"Url": "https://my-invoice-webhook.com",
"EventTypes": [
"invoice_completed"
]
}
Request payload for creating a route plan subscription for when a driver is allocated to a route and when that route is dispatched, for route plan XYZ:
{
"EntityType": "RoutePlan",
"EntityId": "XYZ",
"Url": "https://my-route-plan-webhook.com",
"EventTypes": [
"driver_allocated_to_route",
"route_dispatched"
]
}