Developer
Shipment Updated Event
Documentation for the shipment.updated webhook event
The shipment.updated event is triggered whenever a shipment's status or information is updated.
Event Type
shipment.updatedWhen It's Triggered
This event is sent when:
- Shipment status changes (e.g., from PENDING to IN_TRANSIT)
- Tracking information is updated
- Delivery estimate changes
- Platform updates shipment details
- Shipment attempt number increases (rescheduled delivery)
Webhook Payload Structure
{
"event": "shipment.updated",
"timestamp": "2026-02-16T14:30:00.000Z",
"data": {
"shipmentId": "ship_abc123",
"trackingCode": "TRK123456789",
"platformConsignmentId": "CONS-789456",
"invoice": "INV-GROUP-og_abc123-1708426800000",
"status": "IN_TRANSIT",
"platformType": "STEADFAST",
"shippedAt": "2026-02-15T11:00:00.000Z",
"deliveredAt": null,
"bulkShipmentId": "bulk_xyz789",
"attemptNumber": 1,
"orderGroupId": "og_abc123",
"orderGroupCode": "ORD-2026-001",
"deliveryCharge": 50,
"advancedPayment": 500,
"customer": {
"id": "cust_123",
"name": "John Doe",
"email": "john@example.com",
"phoneNumber": "+1234567890",
"shippingAddress": "123 Main St, City, Country"
},
"totalQuantity": 3,
"orderCount": 2,
"createdAt": "2026-02-15T11:00:00.000Z",
"updatedAt": "2026-02-16T14:30:00.000Z",
"platformResponse": {
"status": "in_transit",
"current_location": "Distribution Center"
},
"errorMessage": null,
"orders": [
{
"id": "item_1",
"productId": "prod_abc",
"productName": "Wireless Headphones",
"variant": "Black",
"quantity": 2,
"productImages": ["https://example.com/image1.jpg"],
"product": {
"id": "prod_abc",
"name": "Wireless Headphones",
"retailPrice": 2500,
"wholesalePrice": 2000,
"soldPrice": 2300,
"description": "Premium wireless headphones",
"images": ["https://example.com/image1.jpg"]
}
}
]
}
}Field Descriptions
Root Level
| Field | Type | Description |
|---|---|---|
event | string | Always "shipment.updated" for this event |
timestamp | string | ISO 8601 timestamp when the webhook was sent |
data | object | The shipment data object (see below) |
Data Object
| Field | Type | Required | Description |
|---|---|---|---|
shipmentId | string | Yes | Unique identifier for the shipment |
trackingCode | string | No | Tracking code from shipping platform |
platformConsignmentId | string | No | Consignment ID from shipping platform |
invoice | string | Yes | Invoice number for the shipment |
status | string | Yes | Current shipment status (see Status Values) |
platformType | string | No | Shipping platform used (STEADFAST, PATHAO) |
shippedAt | string | No | ISO 8601 timestamp when shipment was created |
deliveredAt | string | No | ISO 8601 timestamp when delivered (null if not delivered) |
bulkShipmentId | string | No | ID if part of bulk shipment batch |
attemptNumber | number | Yes | Current shipment attempt number |
orderGroupId | string | Yes | Associated order group ID |
orderGroupCode | string | No | Human-readable order code |
deliveryCharge | number | No | Delivery charge for this shipment |
advancedPayment | number | No | Advance payment amount |
customer | object | Yes | Customer information (see below) |
totalQuantity | number | Yes | Total items in shipment |
orderCount | number | Yes | Number of order line items |
createdAt | string | Yes | ISO 8601 timestamp of shipment creation |
updatedAt | string | Yes | ISO 8601 timestamp of last update |
platformResponse | object | No | Raw response from shipping platform |
errorMessage | string | No | Error message if any |
orders | array | Yes | Array of order items being shipped (see Order Item Object) |
Customer Object
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Unique customer identifier |
name | string | Yes | Customer's full name |
email | string | No | Customer's email address |
phoneNumber | string | No | Customer's phone number |
shippingAddress | string | No | Complete shipping address |
Order Item Object
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Unique order item identifier |
productId | string | Yes | Product identifier |
productName | string | Yes | Name of the product |
variant | string | No | Product variant |
quantity | number | Yes | Quantity of this item |
productImages | array | No | Array of image URLs |
product | object | No | Full product details |
Enum Values
Status Values
PENDING- Shipment created, awaiting pickupIN_TRANSIT- Shipment is in transitDELIVERED- Shipment has been deliveredCANCELLED- Shipment has been cancelledRETURNED- Shipment has been returned
Platform Types
STEADFAST- Steadfast courier servicePATHAO- Pathao courier service
Example Handler
Node.js / Express
app.post('/webhooks/shipments', async (req, res) => {
const { event, data } = req.body;
if (event === 'shipment.updated') {
const { shipmentId, status, trackingCode, customer } = data;
// Notify customer of status change
if (status === 'IN_TRANSIT') {
await sendStatusNotification(customer.email, {
status: 'In Transit',
trackingCode,
message: 'Your order is on the way!',
});
}
// Update internal systems
await updateShipmentStatus(shipmentId, status);
// Log status change for analytics
await logShipmentEvent({
shipmentId,
event: 'status_updated',
oldStatus: await getOldStatus(shipmentId),
newStatus: status,
});
console.log(`Shipment ${shipmentId} updated to ${status}`);
}
res.status(200).json({ received: true });
});Python / Flask
@app.route('/webhooks/shipments', methods=['POST'])
def handle_shipment_webhook():
payload = request.get_json()
event = payload.get('event')
data = payload.get('data')
if event == 'shipment.updated':
shipment_id = data['shipmentId']
status = data['status']
customer = data['customer']
# Send status update notification
if status == 'IN_TRANSIT':
send_status_email(
customer['email'],
status='In Transit',
tracking_code=data['trackingCode']
)
# Update database
update_shipment_status(shipment_id, status)
print(f"Shipment {shipment_id} updated to {status}")
return jsonify({'received': True}), 200Use Cases
1. Real-time Status Notifications
Keep customers informed about their shipment progress:
async function handleStatusUpdate(shipmentData) {
const { status, customer, trackingCode } = shipmentData;
const statusMessages = {
PENDING: 'Your order is awaiting pickup',
IN_TRANSIT: 'Your order is on the way',
OUT_FOR_DELIVERY: 'Your order is out for delivery today',
};
if (statusMessages[status]) {
await smsService.send({
to: customer.phoneNumber,
message: `${statusMessages[status]}. Track: ${trackingCode}`,
});
}
}2. Delivery Exception Handling
Monitor for delays or issues:
async function checkForExceptions(shipmentData) {
const { attemptNumber, status, shipmentId } = shipmentData;
// Alert if multiple delivery attempts
if (attemptNumber > 1) {
await notifyCustomerService({
shipmentId,
issue: 'Multiple delivery attempts',
attemptNumber,
});
}
// Check for stalled shipments
if (status === 'IN_TRANSIT') {
const daysSinceShipped = getDaysSince(shipmentData.shippedAt);
if (daysSinceShipped > 5) {
await flagForReview(shipmentId, 'Delivery taking longer than expected');
}
}
}3. Status Timeline Tracking
Build a comprehensive shipment history:
async function trackStatusHistory(shipmentData) {
const { shipmentId, status, updatedAt } = shipmentData;
await db.shipmentStatusHistory.create({
shipmentId,
status,
timestamp: updatedAt,
platformResponse: shipmentData.platformResponse,
});
// Calculate average delivery times
if (status === 'DELIVERED') {
await updateDeliveryMetrics({
platformType: shipmentData.platformType,
shippedAt: shipmentData.shippedAt,
deliveredAt: shipmentData.deliveredAt,
});
}
}Best Practices
- Track Status Changes - Maintain a history of all status updates for analytics
- Notify Proactively - Send updates for key status changes (in transit, out for delivery)
- Handle Exceptions - Monitor for multiple attempts or unusual delays
- Compare Timestamps - Use
updatedAtvscreatedAtto calculate transit times - Validate Updates - Check if status actually changed before taking action
Common Status Transitions
PENDING → IN_TRANSIT → DELIVERED
PENDING → CANCELLED
IN_TRANSIT → RETURNEDRelated Events
shipment.created- Initial shipment creationshipment.delivered- Successful deliveryshipment.cancelled- Shipment cancellation
Testing
Test this webhook using the webhook testing tool in your dashboard:
- Navigate to Webhooks → Your Webhook → Test
- Select
shipment.updatedevent - Send test payload with different status values
- Verify your handler processes status changes correctly
Need Help?
- Check the Getting Started Guide for setup instructions
- Review webhook security best practices
- Contact support if you encounter issues