Creating a Webhook Configuration
Organizations can subscribe to any of the events listed below via the Create Webhook Config endpoint.
Let's subscribe to the shipment.purchased and billOfLading.created events with the following request.
curl -X POST \
https://sandbox.api.mothership.com/beta/webhookConfig \
-H 'Authorization: Bearer {YOUR_API_TOKEN}' \
-H 'Content-Type: application/json' \
-d '{
"webhookUrl": "https://www.yourserver.com/webhook/mothership",
"subscribedEvents": ["shipment.purchased", "billOfLading.created"]
}'
{
"data": {
"id": "48asjgaoi33nkl4t3lae",
"createdAt": "2019-03-20T16:17:13:424Z",
"status": "active",
"subscribedEvents": ["shipment.purchased", "billOfLading.created"],
"webhookUrl": "https://www.yourserver.io/webhook/mothership",
"secretKey": "de3ADDAek3245DLAdANe91Dn3asklAMSsna03aGKkl23agsJea"
}
}
Webhook Event Type | Description |
---|---|
shipment.purchased | A shipment is purchased by your organization. |
shipment.status.updated | A shipment purchased by your organization has its status updated. |
billOfLading.created | A shipment purchased by your organization has its bill of lading document created for the first time. |
billOfLading.updated | A shipment purchased by your organization has its bill of lading document updated. |
proofOfDelivery.created | A shipment purchased by your organization has its proof of delivery document created for the first time. |
proofOfDelivery.updated | A shipment purchased by your organization has its proof of delivery document updated. |
certificateOfInsurance.created | A shipment purchased by your organization has its certificate of insurance document created for the first time. |
Multiple Webhook Configs
Organizations can create many webhook configurations to support handling different event types with different endpoints.
Note that webhook configurations are scoped to the underlying organization rather than to the developer account through which they were created. An endpoint registered by any account associated with an organization will receive all events corresponding to its webhook configuration.
Updated about 2 months ago