Developer
Shipment Created Event
Documentation for the shipment.created webhook event
The shipment.created event is triggered whenever a new shipment is successfully created for an order group.
Event Type
shipment.createdWhen It's Triggered
This event is sent when:
- An order group is successfully shipped through a shipping platform (Steadfast, Pathao, etc.)
- A shipment is created and tracking information is generated
- Orders within the group are marked as SHIPPED
Webhook Payload Structure
{
"event": "shipment.created",
"timestamp": "2026-02-15T11:00:00.000Z",
"data": {
"shipmentId": "ship_abc123",
"trackingCode": "TRK123456789",
"platformConsignmentId": "CONS-789456",
"invoice": "INV-GROUP-og_abc123-1708426800000",
"status": "PENDING",
"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-15T11:00:00.000Z",
"platformResponse": {
"success": true,
"consignment_id": "CONS-789456",
"tracking_code": "TRK123456789"
},
"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.created" 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 | 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 initially) |
bulkShipmentId | string | No | ID if part of bulk shipment batch |
attemptNumber | number | Yes | Shipment attempt number (starts at 1) |
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 (null on success) |
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.created') {
const { shipmentId, trackingCode, customer, status } = data;
// Send tracking info to customer
await sendTrackingNotification(customer.email, {
trackingCode,
estimatedDelivery: '2-3 business days',
});
// Update internal systems
await updateShipmentStatus(shipmentId, status);
console.log(
`Shipment ${shipmentId} created with tracking: ${trackingCode}`,
);
}
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.created':
shipment_id = data['shipmentId']
tracking_code = data['trackingCode']
customer = data['customer']
# Send notification
send_tracking_email(
customer['email'],
tracking_code=tracking_code
)
# Update database
update_shipment_record(shipment_id, data)
print(f"Shipment {shipment_id} created")
return jsonify({'received': True}), 200Use Cases
1. Customer Notifications
Automatically send tracking information to customers when their order is shipped:
async function notifyCustomer(shipmentData) {
const { customer, trackingCode, platformType } = shipmentData;
await emailService.send({
to: customer.email,
subject: 'Your order has been shipped!',
template: 'shipment-created',
data: {
customerName: customer.name,
trackingCode: trackingCode,
trackingUrl: getTrackingUrl(platformType, trackingCode),
},
});
}2. Inventory Management
Update inventory systems when items are shipped:
async function updateInventory(shipmentData) {
for (const order of shipmentData.orders) {
await inventory.recordShipment({
productId: order.productId,
quantity: order.quantity,
shipmentId: shipmentData.shipmentId,
});
}
}3. Analytics Tracking
Track shipping metrics for business intelligence:
async function trackShipmentMetrics(shipmentData) {
await analytics.track({
event: 'Shipment Created',
properties: {
shipmentId: shipmentData.shipmentId,
platformType: shipmentData.platformType,
totalItems: shipmentData.totalQuantity,
deliveryCharge: shipmentData.deliveryCharge,
destination: shipmentData.customer.shippingAddress,
},
});
}Best Practices
- Store Tracking Information - Save tracking codes and platform details for customer inquiries
- Send Timely Notifications - Notify customers immediately when their order ships
- Monitor Status - Track shipment progression through subsequent webhook events
- Handle Failures Gracefully - Check
errorMessagefield and implement retry logic - Link to Orders - Use
orderGroupIdto maintain relationship between orders and shipments
Related Events
shipment.updated- Shipment status changesshipment.delivered- Delivery confirmationshipment.cancelled- Shipment cancellation
Testing
Test this webhook using the webhook testing tool in your dashboard:
- Navigate to Webhooks → Your Webhook → Test
- Select
shipment.createdevent - Send test payload to your endpoint
- Verify your handler processes it correctly
Need Help?
- Check the Getting Started Guide for setup instructions
- Review webhook security best practices
- Contact support if you encounter issues