When making Postmen API request, you can give a parameter async=true to receive a webhook notification when Postmen has the response ready. In order to receive a webhook, you need to enable the webhook setting first.
In the API request, you have to:
async |
boolean | enable async mode or not |
Webhook data is sent as JSON in the POST request body.
The webhook envelope contains:
{
"event": "calculate_rates",
"date_time": "2016-09-26T07:15:30+00:00",
"meta": {
// meta and body, are same as our API envelope
},
"data": {
// https://docs.postmen.com/overview.html#the-envelope
}
}
Events
Event | Description |
calculate_rates | When POST /rates API is done |
create_a_label | When POST /labels API is done |
manifest_a_label | When POST /manifests API is done |
cancel_a_label | When POST /cancel-labels API is done |
Example
calculated rate webhook
{
"event": "calculate_rates",
"date_time": "2016-09-26T07:15:30+00:00",
"meta": {
"code": 4713,
"message": "All or partial failed in rate request.",
"details": [],
"retryable": false
},
"data": {
"created_at": "2016-09-26T07:15:26+00:00",
"id": "xxxxxx-3b12-4376-bc3d-33333333",
"updated_at": "2016-09-26T07:15:30+00:00",
"status": "calculated",
"rates": [
{
"shipper_account": {
"id": "yyyyyy-1b7a-45da-8e1f-67898736567",
"slug": "fedex",
"description": "fedex testing account"
},
"service_type": null,
"service_name": null,
"pickup_deadline": null,
"booking_cut_off": null,
"delivery_date": null,
"transit_time": null,
"error_message": null,
"info_message": null,
"charge_weight": null,
"total_charge": null,
"detailed_charges": []
}
]
}
}