Webhook metadata
Metadata is additional information you can include in many Shippo objects. For some of these objects (transaction, shipment, and batch), this metadata can be very useful when handling webhook notifications because it allows you to associate your own custom data with the Shippo objects.
The following example shows how to use metadata with a transaction and the resulting webhook payload that is created.
Create a transaction_created webhook
If you do not have one already, create a webhook with event type Transaction Created following the setting up and testing webhooks guide.
Create a transaction
Purchase a label by calling thetransactions endpoint. Include the field metadata with a string containing your additional information.
Create transaction request
Webhook payload
The Shippo API will send a webhook payload to your URL including themetadata you configured in your transaction.
Webhook metadata for tracking
Metadata from a transaction does not get passed to your tracking webhook payload. You can add metadata to an existing tracking object by re-registering your tracking webhook. Use thetracking_number from your transaction response along with your carrier and metadata. This metadata will be included in all webhook payloads associated with tracking updates for this tracking_number.