Using webhooks as a push API
The Safecube Webhooks API serves two purposes: notifying your users about specific changes in the tracking data, and updating your data automatically without any Container Tracking API request. Used the second way, it is a push container tracking API. The Synchronous and asynchronous tracking page compares both approaches.
Steps of a push integration
Using the Webhooks API as a push API takes five steps:
- Set up how you want to receive the data: create an endpoint.
- Push the shipment details to the Safecube monitoring system: add shipments to the endpoint.
- Receive the initial tracking data of each shipment.
- Receive an update whenever Safecube has new data for a shipment.
- Optionally, receive an alert when a shipment you pushed cannot be tracked.
The Getting started with webhooks page shows how to create an endpoint and push your first shipments.
Recommended events for push tracking
Subscribe the endpoint to these events:
| Need | Event |
|---|---|
| Receive the initial tracking data of a shipment | shipment.added.to.endpoint |
| Receive an update whenever new data is available | shipment.any.change |
| Be alerted when a pushed shipment cannot be tracked | shipment.in.error and shipment.auto.removed |
The Webhook events page describes the trigger and payload of each event.
Targeted events alongside push tracking
Using the Webhooks API as a push API does not prevent more targeted notifications. Subscribing to granular events tells you at once what changed, from the event type itself.
For example, date.changed.vessel.arrival.at.final.pod notifies every change of the estimated time of arrival at the POD, while shipment.any.change keeps you informed of every other update.