Afosto fires webhook events for orders, deliveries, shipping labels, picklists and user sessions. Each event delivers a snapshot of the related data inside the data field of the payload envelope. The entity_type and entity_id fields in the envelope tell you which entity the event is about.
·
Note:
An endpoint only receives the events it is subscribed to. Subscriptions are set up by Afosto:
contact Afosto support with the endpoint and the events you want to receive.
The type column shows the entity_type sent in the envelope.
Name
Type
Required
Description
ORDER_CREATED
ORDER
Optional
An order is created. The order may still be a concept. Payload shape: see [ORDER_CREATED and ORDER_RELEASED](#order_created-and-order_released).
ORDER_OPENED
ORDER
Optional
An order is opened: it moved from `CONCEPT` to `OPEN` and processing starts. Payload shape: see [ORDER_OPENED](#order_opened).
ORDER_UPDATED
ORDER
Optional
An order is updated: a status change, items added or removed, an address changed, etc. Payload shape: see [ORDER_UPDATED](#order_updated).
ORDER_RELEASED
ORDER
Optional
Items on an order are released for delivery. Payload shape: see [ORDER_CREATED and ORDER_RELEASED](#order_created-and-order_released).
ORDER_KEYSET_UPDATED
ORDER
Optional
The tags (key sets) on an order are updated. Payload shape: see [ORDER_KEYSET_UPDATED](#order_keyset_updated).
ORDER_CLOSED
ORDER
Optional
An order is closed. Payload shape: see [ORDER_CLOSED](#order_closed).
DELIVERY_IN_TRANSIT
DELIVERY
Optional
A delivery has been handed to the carrier and is in transit. Payload shape: see [DELIVERY_IN_TRANSIT](#delivery_in_transit).
LABEL_CREATED
LABEL
Optional
A shipping label is created for a parcel. Payload shape: see [LABEL_CREATED](#label_created).
PICKLIST_ITEM_PICKED
PICKLIST_ITEM
Optional
An item on a picklist is picked. Payload shape: see [Picklist events](#picklist-events).
PICKLIST_ITEM_UNPICKED
PICKLIST_ITEM
Optional
A pick on a picklist item is undone. Payload shape: see [Picklist events](#picklist-events).
JWT_CREATED
USER
Optional
A user logs in and a session token is issued. Payload shape: see [User session events](#user-session-events).
JWT_REVOKED
USER
Optional
A user logs out and the session token is revoked. Payload shape: see [User session events](#user-session-events).
·
Note:
There is no separate event for a delivered parcel. IN_TRANSIT and DELIVERED are parcel
statuses, not webhook events. Use DELIVERY_IN_TRANSIT to get notified when a delivery ships.
Each order event delivers the order in data directly, as returned by the query for that event. The events select different fields, so check the query for every event you handle.
These events combine more than one entity. Their data field is an object with one key per entity (for example delivery and user), each holding the result of its own query. user is the user who performed the action.
{"event":"DELIVERY_IN_TRANSIT","entity_type":"DELIVERY","entity_id":"5f8a2e7b-0d93-4b3e-9c1d-72fca3442a6f","message_id":"ab12cd34-ef56-7890-1234-abcdef567890","triggered_at":1714050000000,"data":{"delivery":{"expected_at":1714137600000,"method":{"name":"PostNL","is_pickup_point":false},"parcels":[{"id":"1a2b3c4d-5e6f-7890-abcd-ef1234567890","status":"IN_TRANSIT","track_trace":{"number":"3SYZBA123456789","url":"https://track.postnl.nl/3SYZBA123456789"}}]},"user":{"id":"a19c7f3e5d2b4c8a90f1e6d7c4b30258","email":"warehouse@example.nl","name":"Iris de Vries"}}}
{"event":"LABEL_CREATED","entity_type":"LABEL","entity_id":"e7b2d3a1-4c5f-4890-a1b2-c3d4e5f60718","message_id":"5b9e1c73-2a44-4d18-b0e6-7c3f1a9d2e80","triggered_at":1714040000000,"data":{"parcel":{"id":"1a2b3c4d-5e6f-7890-abcd-ef1234567890","track_trace":{"number":"3SYZBA123456789","url":"https://track.postnl.nl/3SYZBA123456789"},"items":[{"sku":"BLK-HOODIE-M","gtin":"8712345678901","label":"Black Hoodie M","order":{"id":"72fca344-2a6f-4b3e-9c1d-5f8a2e7b0d93","number":"1042"}}]},"user":{"id":"a19c7f3e5d2b4c8a90f1e6d7c4b30258","email":"warehouse@example.nl","name":"Iris de Vries"}}}
JWT_CREATED (login) and JWT_REVOKED (logout) deliver the same payload shape. entity_id is the user ID. The data field contains the user as returned by the following query:
The data object always reflects the entity state at the time of the event, not at delivery
time. If retries occur, the data is the same snapshot from when the event was first triggered.
Query Runnerhttps://afosto.app/graphql
No query loaded
Click play on any code block in the docs to load a query here.