Status webhook
Status webhook
Introduction
Before webhooks were implemented the best way to retrieve status updates on a transport document, were by calling the state endpoint in the api.
Now we offer an option for the developer to implement a webhook and thus receiving a call to their own api endpoint every time the state of a transportdocument changes.
More than one 'Status event' webhook can be added. It is also possible to delete, modify or disable/enable a 'Status event' webhook(s).
To summarize a message is received when:
- An update causes the document to shifts from state and you are subscribed on the next document state
- An update does not causes the state to change and you are subscribed on the current state.
The status webhook can be configured on the administration page of the website.
Using webhooks is the preferred way, in the future we will no longer support querying the state endpoints.
Setup
At https://portal.ewastra.com > Admin > Notifications > Status webhook
you will find the following screen:

The configuration consist of 5 input fields:
- In the url box you write a valid https url to your api.
We only accept 'https'endpoints for security reasons. If for 3 consecutive days the webhook endpoint can't be reached, the webhook is automatically disabled and a mail is sent to the technical contact mail (if available)
In the authorization box you can optionally add a authorization header.
A technical contact email address. Is an optional value.
Next to giving a valid url you will have to choose which events you are interested in and then select them by clicking on the checkboxes.
You can also choose to get the entire transportdocument in the request as well by ticking the "include document with state" checkbox.
Example Setup

Do not forget to save the webhook before it is active or enable it, when it is disabled.
Webhook object reference
{
"state": {
"id": 0,
"externalId": "",
"state": 0,
"_stateEnumValues": "0:None, 1:New, 2:Draft, 3:Issued, 4:SignedForPickup, 5:SignedForDelivery, 6:Completed, 8:Cancelled, 10:Deleted",
"cmrNumber": "",
"timestamp": "",
"error": {
"message": "",
"details": [{"key":"value"}]
}
},
"document": {
"_comment": "See Xynaps REST API Reference > definitions > Xynaps.Api.Models.TransportDocument"
}
}