load.changed and trip.changed events carry the full current snapshot of the load or trip in data. In addition, they can include an optional data.diff node that tells you what changed — and, if you opt in, what the value was before.
This lets a consumer decide whether a change is relevant and apply just the delta, instead of re-importing the whole record on every event.
data.diff is only present on load.changed and trip.changed. It is never included on *.status.changed events. See When data.diff is absent for the cases where load.changed and trip.changed also have no data.diff.Shape
data.diff has two independent parts:
data.diff.changes
changes is an array of objects, each { kind, target? }:
kind— a domain-named change type from a fixed vocabulary (for exampleStatusChanged,RateChanged,StopReordered). Kind names describe business concepts — they never expose internal field names or JSON paths.target— present only when the change is scoped to an identified sub-entity. It is{ type, id }:type— a closed set:StoporField.id— the stable identity of that sub-entity as it appears in the snapshot (for a stop, itsStopId— never a positional array index).
target; sub-entity changes carry it.
CarrierRateChanged is trip-only).
load.changed: StatusChanged, RateChanged, FuelSurchargeChanged, AccessorialsChanged, MileageChanged, InvoicedChanged, PaymentRecorded, InvoicingChanged, CustomerChanged, ContractChanged, ScheduleChanged, StopsChanged, DueDateChanged, Delivered, DimensionsChanged, CommodityChanged, NotesChanged, ReferencesChanged, FieldChanged.
trip.changed: StatusChanged, ReleasedChanged, DispatchChanged, CarrierChanged, CarrierPayOnHoldChanged, DriverChanged, TruckChanged, TrailerChanged, TemperatureChanged, CarrierRateChanged, TripValueChanged, FuelSurchargeChanged, DriverRatesChanged, CarrierPaymentRecorded, DueDateChanged, StopAdded, StopRemoved, StopReordered, StopAddressChanged, StopTypeChanged, StopCommodityChanged, StopNotesChanged, StopReferencesChanged, StopInstructionsChanged, AppointmentChanged, ScheduleChanged, ArrivalRecorded, DepartureRecorded, StopStatusChanged, PickedUp, Delivered, VisibilityOrderStatusChanged, MileageChanged, TenderChanged, ReferencesChanged, FieldChanged.
Per-stop kinds (StopAddressChanged, StopTypeChanged, AppointmentChanged, ArrivalRecorded, DepartureRecorded, StopStatusChanged, StopCommodityChanged, StopNotesChanged, StopReferencesChanged, StopInstructionsChanged) carry target: { type: "Stop", id: "<StopId>" }. StopAdded, StopRemoved, and StopReordered are entity-level kinds and have no target.
FieldChanged and the allow-list
Some business values change without a dedicated semantic kind. These surface through a single FieldChanged kind whose target is { "type": "Field", "id": "<ResponsePropertyName>" }.
FieldChanged fires only for an explicit allow-list of fields. In v1:
FieldChanged target.id uses the API model property name (PascalCase, e.g. PONumber). The snapshot and previousAttributes serialize the same fields in JSON camelCase (e.g. poNumber). Do not use target.id as a direct key into the payload — correlate by field identity (or normalize casing in your client).When changes is present
- An empty or absent
changesarray means that no watched business value changed. Bookkeeping fields (for exampleupdatedAt,version, and the etag) never produce achangesentry. "changes": []can reach a subscription that did not turn on Include previous values. This happens when another webhook in the same tenant turned it on. Alvys builds the diff once for the tenant, and then removespreviousAttributesfor subscriptions without the option. For the same kind of write, your subscription can therefore get"changes": []or nodata.diffat all, depending on the settings of other webhooks. Treat both cases the same way.
When data.diff is absent
load.changed and trip.changed have no data.diff in these cases:
- The write created the record. There is no earlier version to compare.
- Alvys found no change to report, and no webhook in your tenant has Include previous values turned on.
- Alvys found no change to report, and the record as the API returns it is the same before and after the write.
data.diff does not mean that the record is new.
data.diff.previousAttributes
previousAttributes carries the previous value of every changed field that is visible on the public response, keyed by response field name — so keys line up 1:1 with the snapshot in the same payload. This lets a state-mirroring consumer apply deltas without a full reconcile.
It is opt-in per subscription — see Enabling previous values.
Rules
- Keyed collections (any array of
id-bearing elements — stops, references, charge lines, …) are diffed by stableid, recursively:removed— the full previous element (no longer in the snapshot).changed— a sparse{ id, ...previous values }(recurses into the element’s own keyed sub-collections).added—{ id }only. The new values are already in the snapshot; theidlets you locate and insert it.
- Every other changed field carries its whole previous value. Arrays of scalars / id-less objects are treated as opaque (the whole previous array is returned).
- Audit fields are included. Unlike
changes,previousAttributesdoes include fields such asupdatedAt, so the channel always confirms a real write happened. previousAttributesis emitted whenever the current and previous responses differ, independently ofchanges. A response-only delta can therefore produce"changes": []alongside a populatedpreviousAttributes.- It is omitted on create and when the two images are identical.
- A field that had no value before the write is sent as JSON
null(for example"poNumber": null). OutsidepreviousAttributesand the envelopesubsidiaryId, webhook payloads omitnullfields. - A field appears here only if it is part of the public response. A change detected on a field that is not exposed on the response still signals via
changesbut carries no value inpreviousAttributes.
Enabling previous values
data.diff.changes is delivered to every subscriber on load.changed and trip.changed events. data.diff.previousAttributes is opt-in and delivered only to subscriptions that request it.
- Dashboard: enable Include previous values on the webhook (see Webhook Lifecycle & Configuration).
- API: set
IncludePreviousAttributestotruewhen creating or updating the subscription (see Create webhook). Defaults tofalse.
Delivery model — one action can produce several events
Alvys sends one webhook per underlying write — deliveries are never merged or de-duplicated. As a result, a single user action can produce more than one event:- Parent cascades. Editing a value on a trip re-saves its parent load (and some load edits re-save related records). For example, changing Paid Loaded Miles on a trip produces a
trip.changedcarryingMileageChangedand a companionload.changedwhosechangesis[](onlyupdatedAtdiffers) — the load’s public content genuinely didn’t change. - Batched, concurrent writes. Events are delivered as the store commits them, in batches. A single burst can contain writes for different records, and from different users, that happened at the same time — they are not necessarily related to one another.
Worked examples
A full load.changed envelope
See load.changed with previous values for a full envelope. A subscription without Include previous values gets the same body without previousAttributes.
A field change on a load (FieldChanged)
Setting the PO number on a load from the dashboard. PONumber is on the Load allow-list, so it surfaces as FieldChanged; the previous value was empty (null). This is a single load.changed — editing a load field re-saves only the load:
null) — no snapshot cache, no full re-sync.
A trip field edit and its parent cascade
Changing Paid Loaded Miles from 500 to 400 on a trip delivers two events — the meaningfultrip.changed plus a content-free load.changed cascade. (MileageChanged covers trip mileage fields including paid/loaded miles.)
previousAttributes lists every response field that changed. This edit updates loadedMileage; totalMileage may also appear when the platform recalculates it from the same action.
The trip.changed carries the real change; the load.changed has empty changes because the load’s public content didn’t change — filter it out.
Keyed collections in previousAttributes
When stops or their references change, previousAttributes diffs the collection by stable id — removed / changed / added: