Connect API

Webhook Events

The order events Spoke sends, when it sends each one, and the message body they share.

This document describes the common message structure all of Spoke Connect's webhook events share.

The message body

Any messages sent by Spoke will have the following structure:

EventSchema = Object

Example

Message body
{
  "type": "order.out_for_delivery",
  "version": "v1",
  "created": 1779004800000,
  "data": {
    ..."the order"
  }
}

Properties

NameTypeDescription
typeEventTypeThe event type being sent. This has the format <resource>.<event>. Example: When an order goes out for delivery the type will be order.out_for_delivery.
version'v1'The Spoke Connect API version for this event. See API Versions.
creatednumberWhen Spoke recorded the change on the order, in milliseconds since epoch. It stays the same when Spoke retries the call. For the time of an attempt, use data.progress.attemptedAt.
dataOrderThe order, in the same shape GET /orders/{id} returns.

data is the Order model, unchanged, so the parsing code you wrote for the API also reads webhooks. It includes progress, the attempt result, photos, the signee name, and the tracking link, so you do not need a follow-up request. The timestamps inside data are in seconds, as the API returns them. Only created is in milliseconds.

data.progress.eta follows the same rules as the API: available with a value, pending when it is not calculated yet, or restricted when the courier's subscription does not include ETAs.

EventType

The EventType defines what happened to the order.

EventType = "order.scheduled" | "order.out_for_delivery" | "order.tracking_link_added" | "order.attempted_delivery" | "test.send_event"

Description

  • order.scheduled: When the courier puts the order on a route, or the date of that route changes. A move to a route on a different date sends this event again. The data field is an Order.
  • order.out_for_delivery: When the package starts making its way to the recipient. This is triggered when the driver starts the route the order is on. The data field is an Order.
  • order.tracking_link_added: When a tracking link becomes available for the order. The data field is an Order.
  • order.attempted_delivery: When the driver completes a delivery attempt, whether it succeeded or not. If the courier undoes an attempt and the driver tries again, a second event is sent for the same order. The data field is an Order.
  • test.send_event: Event sent when you select Test webhook in Connect. You cannot select it, and it is not retried. The data field is a static (mock) Order that does not belong to your retailer.
  • Spoke sends the order.* events for every order your retailer can read through the API, on any courier. It sends nothing for demo or deleted orders. An order the courier creates directly on a route sends the events its state matches when it is created.
  • Spoke does not send events for changes you make yourself, such as creating, editing, submitting, or withdrawing an order. You already have the API response for those.
  • When the courier moves an order to another route on the same date, Spoke sends no event: the order does not record which route it is on, and the route date you see does not change.
  • Spoke will not send more than one event per request, so a change that sends several events sends several requests.

Was this page helpful?