Use Webhooks for Tracking
Automatically receive tracking updates as they occur.
About webhooks for tracking with Shipium
Webhooks are a convenient way for your organization to be notified automatically of tracking event updates, eliminating the need to repeatedly call the Shipment Tracking API to check a tracking event status. Once you register a webhook for your organization, the next tracking update for your event will send notifications to the API endpoint for trackings matching your selected data fields (e.g., eventType
).
This document guides you through the steps to register your organization's webhook. To start, you’ll need to access the Shipium Console.
One webhook registered per application to be notified with tracking event updates
Your organization can use a Shipium webhook to receive tracking event updates to one API endpoint (or application), and then manage those updates via your internal processing system or pass them to your internal customers.
For example, if you have customers A, B, and C that need to receive tracking event updates automatically, you would register one Shipium webhook for Customer A, one for Customer B, and one for Customer C, with three unique API endpoints.
One webhook per application to be notified with updates
Shipium suggests creating one webhook per desired application for which your organization needs to receive tracking event updates.
Once you've registered your organization's webhook, you can disable, delete, and enable it via the Shipium Console. You also can view a summary of all your registered webhooks within the console.
Steps to register your webhook
These steps are not live in production yet.
The webhook registration steps provided here are not live in production for Shipium Beta customers of this service. Your Shipium contact will notify you when these user interface components are available in the Shipium Console. In the interim, please work directly with your Shipium contact to manage your webhook.
Once in the Shipium Console, you'll follow these instructions to register your organization's webhook:
- In the navigation pane at left, navigate to Tracking, and then Webhooks.
- Select the Add Webhook button to the far right of your screen, located near your organization's user account profile information. Any existing webhooks your organization has previously registered will appear on the Webhooks screen, as the test webhooks appear in the sample screenshot below. If your organization has no existing registered webhooks, this screen will contain no webhooks until you've registered your first one.
-
Complete the required Settings fields shown in the Add Webhook screen.
-
Name. Provide a descriptive name for your webhook. We suggest using a simple naming convention that uses the underscore symbol to separate each element of your webhook's intended use, such as
{organization}_{action}_{app}_{version}
.- Use a descriptive name so it's easy to determine the nature of your webhook (e.g.,
OrganizationName_eastCostTrackingBroker_app1_v1
vs.service_123
). - If this webhook is being used as a test or is meant to be short lived, indicate such in the name (e.g.,
OrganizationName_eastCostTrackingBroker_app1_v1_**Test**
). - Avoid using abbreviations in your name if possible, for greater clarity (e.g.,
OrganizationNameeastCostTrackingBroker_app1_v1
vs.OrganizationName_ectBroker_app1_v1
).
- Use a descriptive name so it's easy to determine the nature of your webhook (e.g.,
-
Payload URL. Create a web app with a Uniform Resource Locator (URL) to use as your webhook to receive tracking event notifications. This is the endpoint deployed on your server to receive incoming webhook tracking events your organization has selected. Enter your Hypertext Transfer Protocol Secure (HTTPS) URL endpoint into the Payload URL field.
-
Tenants. This field will only appear if your organization uses Shipium's Tenant feature.
-
If your organization doesn't use Tenants, you can disregard this step.
-
If you use Tenants, you may want to receive tracking updates for all tenants, only one tenant, or a subset of tenants. This field allows you to determine how to set up automatic tracking updates by tenant.
-
In the first screenshot that follows, All has been selected from the dropdown menu, meaning no further action is required to receive tracking updates for all your organization's tenants.
-
In the second screenshot that follows, individual tenants have been selected from the dropdown menu. The list continues to populate horizontally across the data field as you add desired tenants, whether just one or multiple.
-
-
-
Add Additional Header. You may optionally add custom HTTP endpoint headers to be sent in the webhook event by providing the key and value for the header.
-
-
Next , select the tracking events you’d like to receive automatic tracking event update notifications for. If you choose to customize your selections rather than opting to Send me all event types, use the Tracking Event Types for Your Webhooks section below to help determine your selections.
- For Status, Shipium automatically sets new webhooks to inactive by default. This allows your organization to test your webhook before activating it as well as create a webhook that you may not be ready to activate. The benefit to your organization is a safe testing environment before the webhook starts sending tracking event notifications to your organization's server.
- Finally, send a test payload to your endpoint. Refer to the Final Steps and Sample Webhook Call Content section below for confirmation information.
How will I know I've successfully completed registration?
Net new tracking events will push to your designated endpoint as received once you've completed registration.
Tracking event types for your webhook
The following table maps example carrier delivery steps and messages to the designated tracking event type rollup categories for webhooks.
Tracking event type for webhook | Example carrier delivery step | Message |
---|---|---|
Label Printed | Info Received | Information about this package has been received by the carrier. |
Registered | Not Applicable | The package has been registered for tracking. |
In Transit | Picked Up | The package has been picked up by the carrier. |
In Transit | Arrived Carrier Facility | The package has arrived at a carrier facility. |
In Transit | Departed Carrier Facility | The package has left the carrier facility. |
In Transit | In Transit | The package is in transit to the customer. |
Out For Delivery | Out For Delivery | The package is out for delivery. |
Delivered | Delivered | The package has been delivered. |
Exception | Hold | The package is on hold and in possession of the carrier. |
Exception | Exception | There has been a carrier exception for this package. |
Return to Sender: In Transit | Picked Up | The package is being returned and has been picked up by the carrier. |
Return to Sender: In Transit | Arrived Carrier Facility | The package is being returned and has arrived at a carrier facility. |
Return to Sender: In Transit | Departed Carrier Facility | The package is being returned and has left a carrier facility. |
Return to Sender: In Transit | In Transit | The package is being returned and is in transit to the returns facility. |
Return to Sender: Exception | Hold | The package is being returned, and the package is on hold and in possession of the carrier. |
Return to Sender: Exception | Exception | The package is being returned, and there has been a carrier exception for this package. |
Return to Sender: Out for Delivery | Out For Delivery | The package is being returned and is out for delivery. |
Return to Sender: Delivered | Delivered | The package is being returned and has been delivered. |
Final steps and sample webhook call content
This section provides instructions for responding successfully to your webhook's initial call as well as sample webhook messages as they would appear as incoming tracking event updates.
How to respond to your first webhook call
Once you've successfully registered your organization's webhook, you will start receiving webhook calls. Upon receipt of your webhook call, you'll need to respond with an appropriate Hypertext Transfer Protocol (HTTP) status code to acknowledge successful receipt of your webhook call. Your response must:
- be an HTTP status code within the 200-299 range; and
- be delivered within 3 seconds of receiving the webhook call.
Shipium's automated response to your newly registered webhook
Once you've registered your organization's webhook, Shipium:
- will retry the webhook three times if a 200-level HTTP code response is not received within 3 seconds, as required;
- will log this as an error; and
- may decide to mark your API endpoint as broken if multiple errors are received.
Sample webhook messages
This section provides sample expected webhook messages as they would appear when delivering tracking event updates, for both the standard model and the Tracking Updated event type.
Sample webhook message for standard model
This sample JavaScript Object Notation (JSON) message demonstrates the standard model of the push event sent to your organization's endpoint for your registered webhook.
{
"events": [ // List of events to potentially support notifying in batch
{
"metadata": { // The metadata associated with this event
"eventId": "string", // UUID identifying this event for debugging/idempotency purposes
"eventTimestamp": "date-time", // UTC timestamp of when this event was generated in our system
"eventType": "string", // Indicates what event occurred in our system
"payloadSchemaVersion": "string", // The schema version of this event's payload (major)
"testEvent": boolean // Indicates if this is a test notification instead of a real event
},
"payload": { // The actual event data associated with this event
// eventType specific payload
}
}
]
}
Sample webhook message for eventType tracking_updated
This sample JSON message demonstrates the example model of the push event for eventType tracking_updated
sent to your organization's endpoint for your registered webhook.
{
"events": [
{
"metadata": {
"eventId": "01408a5d-5e2d-4b2b-927f-c65d310ac356",
"eventTimestamp": "2024-09-09T16:21:13.110732395Z",
"eventType": "tracking_updated",
"payloadSchemaVersion": "v1",
"testEvent": false
},
"payload": {
"trackings": [
{
"shipiumTrackingId": "8f803e62-5f48-4f15-b4de-ae741dded55f",
"partnerShipmentId": null,
"carrierId": "usps",
"carrierTrackingId": "9400111206211849664726",
"carrierServiceMethodId": "usps-ground-advantage-service-method",
"shipmentStatus": "Delivered",
"shippedDateTime": "2024-09-05T23:50:00Z",
"deliveredAtDateTime": "2024-09-09T12:03:00-04:00",
"carrierEstimatedDeliveryDate": "2024-09-09T21:00:00-04:00",
"originalCarrierEstimatedDeliveryDate": "2024-09-09T21:00:00-04:00",
"partnerReferenceId": "myPartnerReferenceId",
"carrierTrackingLink": "https://www.usps.com/uspstrack/?trknbr=8675309123",
"trackingEvents": [
{
"carrierDescription": "Delivered, In/At Mailbox",
"shipmentStatus": "Delivered",
"eventDate": "2024-09-09T16:03:00Z",
"postalCode": "10314",
"country": "US",
"city": "STATEN ISLAND",
"region": "NY"
},
{
"carrierDescription": "Out for Delivery",
"shipmentStatus": "Out For Delivery",
"eventDate": "2024-09-09T10:10:00Z",
"postalCode": "10314",
"country": "US",
"city": "STATEN ISLAND",
"region": "NY"
},
{
"carrierDescription": "Arrived at Post Office",
"shipmentStatus": "In Transit",
"eventDate": "2024-09-09T09:28:00Z",
"postalCode": "10314",
"country": "US",
"city": "STATEN ISLAND",
"region": "NY"
},
{
"carrierDescription": "Arrived at USPS Facility",
"shipmentStatus": "In Transit",
"eventDate": "2024-09-07T23:10:00Z",
"postalCode": "10314",
"country": "US",
"city": "STATEN ISLAND",
"region": "NY"
},
{
"carrierDescription": "Departed USPS Regional Facility",
"shipmentStatus": "In Transit",
"eventDate": "2024-09-07T21:46:00Z",
"postalCode": null,
"country": "US",
"city": "BROOKLYN",
"region": "NY"
},
{
"carrierDescription": "Arrived at USPS Regional Facility",
"shipmentStatus": "In Transit",
"eventDate": "2024-09-07T10:21:00Z",
"postalCode": null,
"country": "US",
"city": "BROOKLYN",
"region": "NY"
},
{
"carrierDescription": "Departed USPS Regional Facility",
"shipmentStatus": "In Transit",
"eventDate": "2024-09-07T08:49:00Z",
"postalCode": null,
"country": "US",
"city": "MID",
"region": "NY"
},
{
"carrierDescription": "Arrived at USPS Regional Facility",
"shipmentStatus": "In Transit",
"eventDate": "2024-09-07T05:55:00Z",
"postalCode": null,
"country": "US",
"city": "MID",
"region": "NY"
},
{
"carrierDescription": "Departed USPS Facility",
"shipmentStatus": "In Transit",
"eventDate": "2024-09-06T10:16:00Z",
"postalCode": "30268",
"country": "US",
"city": "PALMETTO",
"region": "GA"
},
{
"carrierDescription": "Arrived at USPS Regional Origin Facility",
"shipmentStatus": "In Transit",
"eventDate": "2024-09-06T01:05:00Z",
"postalCode": null,
"country": "US",
"city": "ATLANTA",
"region": "GA"
},
{
"carrierDescription": "Accepted at USPS Origin Facility",
"shipmentStatus": "In Transit",
"eventDate": "2024-09-05T23:50:00Z",
"postalCode": "30349",
"country": "US",
"city": "ATLANTA",
"region": "GA"
},
{
"carrierDescription": "Shipping Label Created, USPS Awaiting Item",
"shipmentStatus": "Label Printed",
"eventDate": "2024-09-05T20:04:00Z",
"postalCode": "30349",
"country": "US",
"city": "ATLANTA",
"region": "GA"
}
]
}
]
}
}
]
}
Resources
Your Shipium team member is available to help along the way. However, you might find these resources helpful:
Updated 3 days ago