Subscribe to either or both when creating or updating a webhook (see Webhook Lifecycle & Configuration). The full list of valid event-type strings is returned by
GET /api/p/v1.0/webhooks/event-types.
Status vs. changed
trip.status.changed fires only on a status transition and never includes a data.diff.
trip.changed fires on every write to the trip, including status changes, except the writes listed under Writes that send no trip event. It is not limited to writes that change a business value. It can include an optional data.diff that describes what changed. See Change Diffs (data.diff).
One write can send both events: one
trip.status.changed and one trip.changed. Each event has its own id. Use X-Alvys-Event-Id (the same value as the envelope id) to deduplicate, so you process the two events separately and ignore repeat deliveries.Event id format
For trip events, the envelope id has the form {tripId}-{etag}-{0|1}. The last segment is 1 for trip.status.changed and 0 for trip.changed. Treat the id as an opaque string. Use it only to deduplicate, and do not parse it.
Writes that send no trip event
Two kinds of trip write send notrip.changed and no trip.status.changed:
- A write that only relabels carrier payments.
- A write that only changes driver or owner-operator payable amounts and does not change the trip’s
updatedAt.
updatedAt, and changes nothing in the trip as the API returns it, sends no trip.changed. Every save from the app or the API changes updatedAt and still sends it.
To see these changes, read the trip again with the API.
Documents attached to a trip send their own events (trip.document.uploaded and trip.document.deleted). See Document events.
Payload
Trip events use the standard Alvys webhook envelope. When available,data.trip carries the full current snapshot of the trip. The snapshot has the same fields as the Trips API response, with camelCase property names, and fields with a null value are omitted.
Each stop in data.trip.stops carries a $type value that tells you the kind of stop: appointment, delivery_window, or waypoint.
The examples below show only some snapshot fields. A real delivery carries all of them.
trip.status.changed
trip.changed
data.diff also carries previousAttributes. See Change Diffs (data.diff).
Per-stop kinds (
StopAddressChanged, AppointmentChanged, ArrivalRecorded, and the others in the per-stop list) carry a target of { "type": "Stop", "id": "<StopId>" }. The id is the stable stop id from the snapshot, never a position in the array. StopAdded, StopRemoved, and StopReordered are entity-level kinds. They have no target. Compare data.trip.stops with your copy to find which stops were added, removed, or moved.Notes
data.tripcarries the full current snapshot, so you can apply the current state directly. If Alvys cannot build it for a delivery,data.tripis omitted and the event is still delivered; read the trip withGETin that case. To react to only what changed, usedata.diff.- Delivery is at-least-once. Deduplicate on
X-Alvys-Event-Id. See Event Delivery & Reliability. data.diffis never present ontrip.status.changed. Ontrip.changedit is absent when the write created the trip, when Alvys found no change to report and no webhook in your tenant has Include previous values turned on, or when Alvys found no change to report and the trip as the API returns it is the same before and after the write. If Alvys cannot compare the write with the earlier version, it handles the write as one with no change to report. An absentdata.diffdoes not mean that the trip is new.