Subscriptions and Order Webhooks

By using the ‘WebhookUrl’ field or the subscriptions, you can specify a callback URL to get an update when the order is updated status. If the ‘WebhookUrl’ is set when creating an order or if a subscription exists, the API will send an HTTP POST request to that URL with a JSON payload containing the OrderId when the order status is changed. The kind of event that was triggered will be passed in a header called "Event-Type" where possible events are:

  • order_created
  • order_dispatched
  • order_assigned
  • driver_arrived_at_pickup
  • driver_arrived_at_delivery
  • order_picked_up
  • proof_of_delivery_added
  • order_on_hold
  • order_released
  • order_scanned_at_checkpoint
  • pickup_time_window_updated
  • delivery_time_window_updated
  • driver_unassigned
  • items_added
  • items_updated
  • items_removed
  • order_delivered
  • order_cancelled
  • invoice_completed
  • invoice_cancelled
  • 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

The following are examples of call-back content :

[OrderCreated]
Header: Event-Type: "order_created"
Body:
{
"OrderId": "CONTOSO123"
}

[OrderDispatchedToDriver]
Header: Event-Type: "order_dispatched"
Body:
{
"OrderId": "CONTOSO123",
"DriverId": "fe4bc3ab-ece3-4163-aced-13af016877fd"
"DriverNumber": "123"
"DriverName": "Ryan Gosling",
}

[OrderAcceptedByDriver]
Header: Event-Type: "order_assigned"
Body:
{
"OrderId": "CONTOSO123",
"DriverId": "fe4bc3ab-ece3-4163-aced-13af016877fd"
"DriverNumber": "123"
"DriverName": "Ryan Gosling",
}

[DriverArrivedAtPickup]
Header: Event-Type: "driver_arrived_at_pickup"
Body:
{
"OrderId": "CONTOSO123"
}

[OrderPickedUp]
Header: Event-Type: order_picked_up
Body:
{
"OrderId": "CONTOSO123"
}

[DriverUnassigned]
Header: Event-Type: driver_unassigned
Body:
{
"UnassignedDriverId": "fe4bc3ab-ece3-4163-aced-13af016877fd"
"UnassignedDriverNumber": "123"
"UnassignedDriverName ": "Ryan Gosling"
}

[DriverArrivedAtDelivery]
Header: Event-Type: "driver_arrived_at_delivery"
Body:
{
"OrderId": "CONTOSO123"
}

[OrderDelivered]
Header: Event-Type: "order_delivered"
Body:
{
"OrderId": "CONTOSO123",
"CustomerName": "Ron Pearlman"
}

[OrderReleased]
Header: Event-Type: "order_released"
Body:
{
"OrderId": "CONTOSO123"
}

[OrderPutOnHold]
Header: Event-Type: "order_on_hold"
Body:
{
"OrderId": "CONTOSO123",
"HoldReadon": "Nobodyhome",
"HoldReasonDescriptionEn": "No access to door",
"HoldReasonDescriptionFr": "Pas d'accès à la porte"
}

[OrderCancelled]
Header: Event-Type: "order_cancelled"
Body:
{
"OrderId": "CONTOSO123"
}

To test subscriptions, you can use a webhook test service such as these: