Creating a Webhook Configuration

Organizations can subscribe to any of the events listed below via the Create Webhook Config endpoint.

A subscription to the shipment.purchased and billOfLading.created events can be set 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"
  }
}

📘

Refer to our webhook configuration page for detail on webhook payload schemas.

Webhook Event TypeDescription
shipment.purchasedA shipment is purchased by your organization.
shipment.status.updatedA shipment purchased by your organization has its status updated.
billOfLading.createdA shipment purchased by your organization has its bill of lading document created for the first time.
billOfLading.updatedA shipment purchased by your organization has its bill of lading document updated.
proofOfDelivery.createdA shipment purchased by your organization has its proof of delivery document created for the first time.
proofOfDelivery.updatedA shipment purchased by your organization has its proof of delivery document updated.
deliveryReceipt.createdA shipment purchased by your organization has a delivery receipt document attached.
deliveryReceipt.updatedA shipment purchased by your organization has had a new delivery receipt document attached.
certificateOfInsurance.createdA 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.