Webhooks for Carrier Selection & Label Updates
Automatically receive updates for carrier selection and/or label generation events.
About webhooks for event updates with Shipium
Webhooks are a convenient way for your organization to be notified automatically of shipment event updates. You can register for a webhook to be notified of events for each service:
- Carrier selection
- Label generation
You'll need to register a separate webhook for each service – one for carrier selection and one for labels – for which you wish to receive notifications. Once you register a webhook for your organization, the next shipment update for your event will send notifications to the API endpoint for events matching your selected data fields (e.g., eventType
). You will receive webhook notifications whenever a carrier selection or label is created, updated, or deleted, depending on the webhooks you register.
This document guides you through the steps to register a webhook for your organization for either carrier selection or label generation. You can register for both webhooks to receive updates for both carrier selection and label generation. To start, you’ll need to access the Shipium Console. To register a webhook for tracking shipments with Shipium, you can refer to Use Webhooks for Tracking.
One webhook registered per application to be notified with carrier selection or label generation (or both) event updates
Your organization can use a Shipium webhook to receive shipment 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 shipment 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 shipment 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 webhooks.
Once in the Shipium Console, you'll follow these instructions to register your organization's webhook:
- In the navigation pane at left, navigate to Carrier Selection, and then Carrier Selection 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 Carrier Selection Webhooks screen. 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 Carrier Selection 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 shipment event notifications. This is the endpoint deployed on your server to receive incoming webhook shipment 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 shipment updates for all tenants, only one tenant, or a subset of tenants. This field allows you to determine how to set up automatic shipment 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 shipment 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.
-
-
In the Event Type Select section, you'll select the event type for which you wish to be notified via the webhook you're creating. You must register a webhook separately for each event type.
-
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 shipment event notifications to your organization's server.
-
Finally, send a test payload to your endpoint. You'll select the Test Event button in the row of your newly created webhook on the primary Carrier Selection Webhooks page. 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 shipment events will push to your designated endpoint as received once you've completed registration.
Shipment event types for your webhook
The following table includes the event metadata event types that can be returned for a carrier selection or label event notification. Each event type needs its own webhook registration; however, you can point all registered webhooks at the same API.
Event type for webhook | Description |
---|---|
Carrier Selection Created | Represents a carrier selection creation |
Carrier Selection Updated | Represents an update to a created carrier selection |
Carrier Selection Deleted | Represents deletion of a carrier selection |
Label Created | Represents a label creation |
Label Updated | Represents an update to a created label |
Label Deleted | Represents deletion of a label |
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 shipment 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 shipment event updates, for both carrier selection and label events.
This sample JavaScript Object Notation (JSON) message demonstrates the push event sent to your organization's endpoint for your registered webhook. When a webhook is published regarding a carrier selection or label event, it will contain an array with one or more updates.
"events": [ // List of events
{
"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
}
}
]
The elements in the above sample webhook message are described in the following table.
Element | Element type | Description |
---|---|---|
events | Array | List of events in the webhook call; the events array may contain a single event, or multiple events (from one or more shipments). |
events[].metadata | Object | Object containing metadata about a particular update |
events[].metadata.eventId | UUID | A unique identifier associated with this event |
events[].metadata.eventTimestamp | String | Timestamp of when the event in question occurred in ISO-8601 date-time format |
events[].metadata.eventType | String enumeration | The type of event this message represents (Carrier Selection Created, Carrier Selection Updated, Carrier Selection Deleted, Label Created, Label Updated, Label Deleted) |
events[].metadata.partnerId | String | Your organization's unique ID |
events[].metadata.payloadSchemaVersion | String | The version ID for this published message (useful for debugging purposes) |
events[].metadata.testEvent | BooleanTrue or False | If true , the published event was a test event, not a real event. |
events[].payload | Object | Object containing the contents of the message; see the payload data structures below for details. |
Sample webhook message for carrier selection or label create or update shipment event
This sample JSON message demonstrates the example model of the push event for the carrier selection create and update event types sent to your organization's endpoint for your registered webhook. The same payload is used for the label create and update event types, with additional carrier label information populated.
{
"shipiumShipmentId": "ea284495-efe3-4dd2-80bd-d9c269e5286b",
"partnerShipmentId": "CUS-123456",
"orderedDateTime": "2024-08-25T11:01:24-07:00",
"shippedDateTime": "2024-08-27T08:07:34-07:00",
"estimatedDeliveryDate": "2024-08-30T18:00:00-07:00",
"testMode": false,
"packagingType": {
"packagingMaterial": "box",
"linearDimensions": {
"linearUnit": "inches",
"length": 9.0,
"width": 6.0,
"height": 3.0
}
},
"totalWeight": {
"weightUnit": "lb",
"weight": 4.5
},
"shipFromAddress": {
},
"destinationAddress": {
},
"carrierSelection": {
},
"carrierLabel": null
}
Sample webhook message for carrier selection delete shipment event
This sample JSON message demonstrates the example model of the push event for the carrier selection delete event type sent to your organization's endpoint for your registered webhook.
{
"shipiumShipmentId": "ea284495-efe3-4dd2-80bd-d9c269e5286b",
"partnerShipmentId": "CUS-123456",
"carrierSelectionId": "a38578c5-e8ba-4023-8fb0-663e7394733e",
"shipiumLabelId": null,
"carrier": "ups",
"carrierTrackingId": null,
"shippedDateTime": "2024-08-27T08:07:34-07:00",
"deleteDateTime": "2024-08-27T11:00:00-07:00"
}
Sample webhook message for label delete shipment event
This sample JSON message demonstrates the example model of the push event for the label delete event type sent to your organization's endpoint for your registered webhook.
{
"shipiumShipmentId": "ea284495-efe3-4dd2-80bd-d9c269e5286b",
"partnerShipmentId": "CUS-123456",
"carrierSelectionId": "a38578c5-e8ba-4023-8fb0-663e7394733e",
"shipiumLabelId": "6ddf5809-7acb-4590-831e-7ce2773f9e45",
"carrier": "ups",
"carrierTrackingId": "1Z123456789",
"shippedDateTime": "2024-08-27T08:07:34-07:00",
"deleteDateTime": "2024-08-27T11:00:00-07:00"
}
Webhook payload elements defined
Data elements for carrier selection and label create and update shipment event types are defined in the following table.
Element | Element type | Description |
---|---|---|
shipiumShipmentId | String | The unique identifier for the shipment |
partnerShipmentId | String | The optional unique identifier that may be used for the shipment |
shipiumTenantId | String | The Shipium-generated unique identifier for the tenant; when present, this is used to indicate the tenant associated with the shipment |
orderedDateTime | String | The timestamp for when the customer placed an order for the product in ISO 8601 date-time format |
shippedDateTime | String | The timestamp for when you (or your fulfillment partner) shipped the product from your (or their) warehouse in ISO 8601 date-time format |
estimatedDeliveryDate | String | The date and time by when the package is estimated to be delivered to the customer in ISO 8601 date-time format |
testMode | BooleanTrue or False | If true , the label was produced in test mode. The default value is false . |
isReturnLabel | BooleanTrue or False | If true , the label is a return label. The default value is false . |
shipmentTags | String | An optional list of arbitrary string tags associated with this shipment |
packagingType | Object | An object representing the packaging that was used for the shipment. |
packagingType .packagingMaterial | String enumeration Values are: - box - envelope - flat_pack - mailing_tube - parcel_pallet | The type of packaging used to create the package for the shipment |
packagingType.linearDimensions .linearUnit | String enumeration Values are: - cm (centimeter)- in (inch) | The unit in which linear dimensions are provided |
packagingType.linearDimensions .length | Float | The longest linear dimension (i.e., the longest side of a box or envelope) |
packagingType.linearDimensions .width | Float | The second longest linear dimension (i.e., the second longest side of a box or envelope) |
packagingType.linearDimensions .height | Float | The least long linear dimension (i.e., the shortest side of a box or envelope) |
totalWeight.weightUnit | String enumeration Values are: - g (gram)- kg (kilogram)- lb (pound)- oz (ounce) | The unit in which weight values are provided |
totalWeight.weight | Float | The value of the weight in the units specified |
shipFromAddress.countryCode | String enumeration | The ISO 3166-1 country code for the address of the location from which the package is being shipped |
shipFromAddress.region | String | The 2-letter abbreviation of the location's state from which the package is being shipped, for the U.S.; for other countries, this will be province, region, etc. and may be more than 2 characters. |
shipFromAddress.postalCode | String | A country-appropriate postal code for the address of the location from which the package is being shipped |
shipFromAddress.addressType | String enumeration Values are: - Residential - Commercial | The type of location for the location from which the package is being shipped |
destinationAddress.countryCode | String enumeration | The ISO 3166-1 country code for the address of the location to which the package is being shipped |
destinationAddress.region | String | The 2-letter abbreviation of the location's state to which the package is being shipped, for the U.S.; for other countries, this will be province, region, etc. and may be more than 2 characters. |
destinationAddress.postalCode | String | A country-appropriate postal code for the address of the location to which the package is being shipped |
destinationAddress.addressType | String enumeration Values are: - Residential - Commercial | The type of location for the location to which the package is being shipped |
carrierServiceMethodAllowList | Array of strings | The carrierServiceMethodAllowList takes one or more of the carrierServiceMethodId values from the Supported Carriers document provided in an array as its value. Based on that value, it chooses the best carrier and ship method from that list that meets the other criteria specified in the API call. You can find more details in Specify Carrier Service and Method. |
carrierSelection .carrierSelectionId | String | Unique identifier for this carrier selection; used to distinguish between multiple carrier selections for the same shipment; required to retrieve a label by shipment, carrier selection, and label IDs. |
carrierSelection.carrier | String enumeration | A string representing the carrier that was selected for this shipment (though not necessarily what was shipped); carrier IDs for Shipium's supported carriers are listed in Supported Carriers . |
carrierSelection .carrierServiceMethodId | String enumeration | A string representing the carrier service method that was selected for this shipment (though not necessarily what was shipped); carrier service method IDs for Shipium's supported carriers are listed in Supported Carriers . |
carrierSelection .serviceMethodName | String enumeration | A more human-readable representation of the carrierServiceMethodId |
carrierSelection.carrierZoneId | String enumeration | A string representing the carrier’s specific zone ID for the origin-destination pair |
carrierSelection .calculatedBillableWeight .weightUnit | String enumeration Values are: - g (gram)- kg (kilogram)- lb (pound)- oz (ounce) | The unit in which weight values are provided for the calculated billable weight of the shipment |
carrierSelection .calculatedBillableWeight .weight | Float | The value in weight units for the calculated billable weight of the shipment |
carrierSelection.currencyCode | String enumeration | The currency code for the estimated cost of the carrier selection in ISO 4217 format |
carrierSelection.totalCost | Float | The total estimated cost at billing of the shipment in currencyCode units |
carrierSelection .carrierCompareCost | Float | The total estimated cost of the shipment at shipping time in currencyCode units |
carrierSelection.lineItems .name | String Ex.: base rate | The name of the rate modification for the shipment; this may not be present for uncosted rate sheets. |
carrierSelection.lineItems .rate | Number ($float) Ex.: 1.23 | The amount of the rate modification in currency code units for this shipment; this may not be present for uncosted rate sheets. |
carrierSelection .thirdPartyBilling | BooleanTrue or False | If true , the shipment was billed using a third-party billing account; the default value is false . |
carrierSelection .partnerThirdPartyBilling AccountId | String | A billing account identifier associated with the selected carrier, if available |
carrierSelection .timeInTransitModel | String enumeration Values are: - carrier_default_postal - partner_provided_postal - partner_provided_zone - shipium_calculated_postal - shipium_ml_model | A string enumeration representing which model type was used for estimating this particular carrier selection’s time in transit (TNT) model. It will represent the model used for the selected carrier and method only. |
carrierLabel.shipiumLabelId | String | The unique identifier for the Shipium label entity |
carrierLabel.carrier | String enumeration | A string representing the carrier that was selected for this shipment (though not necessarily what was shipped); carrier IDs for Shipium's supported carriers are listed in Supported Carriers . |
carrierLabel .carrierServiceMethodId | String enumeration | A string representing the carrier service method that was selected for this shipment (though not necessarily what was shipped); carrier service method IDs for Shipium's supported carriers are listed in Supported Carriers . |
carrierLabel.carrierTrackingId | String | The carrier's tracking identifier for the package |
carrierLabel .labelCreationDateTime | String | The timestamp for when the label was created in ISO 8601 date-time format |
carrierLabel.carrierLabelPrice | Float | The total cost at shipping for the shipment returned from the carrier in currencyCode units |
carrierLabel .carrierLabelCurrencyCode | String | The currency code for the carrier label cost in ISO-4217 format |
carrierLabel .carrierFailoverOccurred | BooleanTrue or False | If true , the preferred carrier that was selected was unable to get a label and another carrier was selected; this value is false for all other cases. |
carrierLabel .carrierFailoverReason | String enumeration Values are: - slow_carrier_api_response - failed_carrier_api_response - other | This value is null if carrierFailoverOccurred is false . If carrierFailoverOccurred is true , then this value will be populated with one of the enumerated values representing the reason for the failover. This list may grow over time so you may see unexpected outputs beyond those listed. |
carrierLabel .partnerThirdPartyBilling AccountId | String | A billing account identifier associated with the selected carrier, if available; this may be different than the carrierSelection in the event of a carrierFailover . |
The following table includes descriptions of data elements for carrier selection and label delete shipment event types.
Element | Element type | Description |
---|---|---|
shipiumShipmentId | String | The unique identifier for the shipment |
partnerShipmentId | String | The optional unique identifier that may be used for the shipment |
carrierSelectionId | String | Unique identifier for a carrier selection (useful if you are recording Shipium carrier selection IDs) |
shipiumLabelId | String | Unique Shipium identifier for a label (useful if you are recording Shipium label IDs during carrier selection) |
carrier | String enumeration | A string representing the carrier that was selected for this shipment (though not necessarily what was shipped); carrier IDs for Shipium's supported carriers are listed in Supported Carriers. |
carrierTrackingId | String | The carrier's tracking identifier for the package |
shippedDateTime | String | The timestamp for when you (or your fulfillment partner) shipped the product from your (or their) warehouse in ISO 8601 date-time format |
deleteDateTime | String | The date-time at which the carrier selection or label of the impacted shipment was deleted in ISO 8601 date-time format |
Resources
Your Shipium team member is available to help along the way. However, you might find these resources helpful:
Updated 1 day ago