Skip to main content
Alvys emits webhook events for the load lifecycle, so external systems stay in sync in real time instead of polling the Loads API. 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. Documents attached to a load send their own events (load.document.uploaded and load.document.deleted). See Document events.

Status vs. changed

load.status.changed fires only on a status transition and never includes a data.diff. It fires once, on the write that changes the status. A later write that keeps the same status does not send it again. load.changed fires on every write to the load, including status changes, except the write described under Writes that send no load 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 load.status.changed and one load.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 load events, the envelope id has the form {loadId}-{etag}-{0|1}. The last segment is 1 for load.status.changed and 0 for load.changed. Treat the id as an opaque string. Use it only to deduplicate, and do not parse it.

Writes that send no load event

A background system update that does not change the load’s updatedAt, and changes nothing in the load as the API returns it, sends no load.changed. Every save from the app or the API changes updatedAt and still sends it, including the save of a load after one of its trips changes.

Payload

Load events use the standard Alvys webhook envelope. When available, data.load carries the full current snapshot of the load. The snapshot has the same fields as the GET /api/p/v2.0/loads response, with two differences:
  • Property names are camelCase (loadNumber, poNumber), not PascalCase.
  • Fields with a null value are omitted.
The examples below show only some snapshot fields. A real delivery carries all of them.

load.status.changed

data has no separate load id or load number. Read them from data.load.id and data.load.loadNumber.

load.changed with previous values

This example is for a subscription with Include previous values turned on. The write changed the status, edited the references, and set a PO number that was empty before.
previousAttributes holds the value of each changed field before the write:
  • "poNumber": null means the field had no value before the write. Outside previousAttributes and the envelope subsidiaryId, webhook payloads omit null fields.
  • references is a list of items that each have an id, so Alvys compares it item by item. removed holds the full old item. changed holds the id and the old values of the fields that changed. added holds only the id, because the new item is already in the snapshot. An empty bucket is omitted.
  • updatedAt and other audit fields are included.

load.changed without previous values

A subscription without Include previous values gets data.diff.changes only:

When data.diff is absent

load.changed has no data.diff in these cases:
  • The write created the load. 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 load 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 absent data.diff does not mean that the load is new. To detect a new load, compare data.load.id with the loads you already have.

Load status values

status and previousStatus contain one of these values: Admin, In Review, Open, Quoted, Reserved, Covered, Dispatched, In Transit, Delivered, TONU, Released, Released-Carrier Paid, Carrier Paid, Trip Completed, Queued, Invoiced, Financed, Completed, Paid, Cancelled, En-Route The field is a string, not an enum. Compare values without regard to case, and accept a value that is not in this list.

Notes

  • data.load carries the full current snapshot, so you can apply the current state directly. If Alvys cannot build it for a delivery, data.load is omitted and the event is still delivered. In that case, read the load with GET /api/p/v2.0/loads. To react to only what changed, use data.diff.
  • Delivery is at-least-once. Deduplicate on X-Alvys-Event-Id. See Event Delivery & Reliability.
  • data.diff is never present on load.status.changed.