Developer
Shipment Delivered Event
Documentation for the shipment.delivered webhook event
The shipment.delivered event is triggered when a shipment has been successfully delivered to the customer.
Event Type
shipment.deliveredWhen It's Triggered
This event is sent when:
- Shipping platform confirms successful delivery
- Shipment status changes to DELIVERED
- Proof of delivery is recorded
- Customer receives their order
Webhook Payload Structure
{
"event": "shipment.delivered",
"timestamp": "2026-02-18T10:45:00.000Z",
"data": {
"shipmentId": "ship_abc123",
"trackingCode": "TRK123456789",
"platformConsignmentId": "CONS-789456",
"invoice": "INV-GROUP-og_abc123-1708426800000",
"status": "DELIVERED",
"platformType": "STEADFAST",
"shippedAt": "2026-02-15T11:00:00.000Z",
"deliveredAt": "2026-02-18T10:45:00.000Z",
"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-18T10:45:00.000Z",
"platformResponse": {
"status": "delivered",
"delivered_at": "2026-02-18T10:45:00.000Z",
"delivery_signature": "John Doe",
"proof_of_delivery": "https://platform.com/proof/123.jpg"
},
"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.delivered" 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 | Will always be "DELIVERED" for this event |
platformType | string | No | Shipping platform used (STEADFAST, PATHAO) |
shippedAt | string | No | ISO 8601 timestamp when shipment was created |
deliveredAt | string | Yes | ISO 8601 timestamp of successful delivery |
bulkShipmentId | string | No | ID if part of bulk shipment batch |
attemptNumber | number | Yes | Final delivery 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 delivery |
platformResponse | object | No | Raw delivery confirmation from platform |
errorMessage | string | No | Should be null for delivered shipments |
orders | array | Yes | Array of order items delivered (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 | Delivery 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 delivered |
productImages | array | No | Array of image URLs |
product | object | No | Full product details |
Enum Values
Status Values
For this event, status will always be:
DELIVERED- Shipment has been successfully delivered
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.delivered') {
const { shipmentId, customer, deliveredAt, shippedAt, orders } = data;
// Calculate delivery time
const deliveryTime = new Date(deliveredAt) - new Date(shippedAt);
const deliveryDays = Math.floor(deliveryTime / (1000 * 60 * 60 * 24));
// Send delivery confirmation
await sendDeliveryConfirmation(customer.email, {
orderItems: orders,
deliveredAt,
deliveryDays,
});
// Request feedback
await scheduleReviewRequest(customer.id, {
delay: '3 days',
products: orders.map((o) => o.productId),
});
// Update order status to completed
await markOrderCompleted(data.orderGroupId);
// Update metrics
await recordDeliveryMetrics({
shipmentId,
platformType: data.platformType,
deliveryDays,
attemptNumber: data.attemptNumber,
});
console.log(`Shipment ${shipmentId} delivered in ${deliveryDays} days`);
}
res.status(200).json({ received: true });
});Python / Flask
from datetime import datetime
@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.delivered':
shipment_id = data['shipmentId']
customer = data['customer']
delivered_at = datetime.fromisoformat(data['deliveredAt'])
shipped_at = datetime.fromisoformat(data['shippedAt'])
# Calculate delivery time
delivery_days = (delivered_at - shipped_at).days
# Send confirmation email
send_delivery_confirmation(
customer['email'],
delivery_date=delivered_at,
delivery_days=delivery_days
)
# Request review
schedule_review_request(
customer_id=customer['id'],
delay_days=3,
products=[order['productId'] for order in data['orders']]
)
# Complete order
mark_order_completed(data['orderGroupId'])
print(f"Shipment {shipment_id} delivered in {delivery_days} days")
return jsonify({'received': True}), 200Use Cases
1. Delivery Confirmation
Send confirmation and thank customers:
async function confirmDelivery(shipmentData) {
const { customer, orders, deliveredAt } = shipmentData;
await emailService.send({
to: customer.email,
subject: 'Your order has been delivered! 🎉',
template: 'delivery-confirmation',
data: {
customerName: customer.name,
deliveryDate: new Date(deliveredAt).toLocaleDateString(),
items: orders.map((o) => ({
name: o.productName,
quantity: o.quantity,
image: o.productImages[0],
})),
},
});
}2. Review Requests
Automatically request product reviews after delivery:
async function scheduleReviews(shipmentData) {
const { customer, orders, shipmentId } = shipmentData;
// Wait 3 days then ask for reviews
await reviewQueue.add({
customerId: customer.id,
products: orders.map((o) => ({
productId: o.productId,
productName: o.productName,
})),
shipmentId,
sendAt: new Date(Date.now() + 3 * 24 * 60 * 60 * 1000),
});
}3. Performance Analytics
Track delivery performance metrics:
async function analyzeDelivery(shipmentData) {
const {
shipmentId,
platformType,
shippedAt,
deliveredAt,
attemptNumber,
customer,
} = shipmentData;
const deliveryTime = new Date(deliveredAt) - new Date(shippedAt);
const deliveryHours = deliveryTime / (1000 * 60 * 60);
await analytics.track({
event: 'Delivery Completed',
properties: {
shipmentId,
platformType,
deliveryHours,
deliveryDays: Math.floor(deliveryHours / 24),
attemptNumber,
onTimeDelivery: deliveryHours <= 72, // 3 days
destination: customer.shippingAddress,
},
});
// Alert if delivery took too long
if (deliveryHours > 120) {
// 5 days
await alertManagement({
type: 'slow_delivery',
shipmentId,
deliveryHours,
});
}
}4. Loyalty Rewards
Award points or discounts for completed orders:
async function awardLoyaltyPoints(shipmentData) {
const { customer, orders, orderGroupId } = shipmentData;
const totalValue = orders.reduce((sum, order) => {
return sum + order.product.retailPrice * order.quantity;
}, 0);
await loyaltyProgram.addPoints({
customerId: customer.id,
points: Math.floor(totalValue / 100), // 1 point per 100 currency
reason: `Order ${orderGroupId} delivered`,
orderId: orderGroupId,
});
}Best Practices
- Send Confirmation - Always notify customers when delivery is confirmed
- Calculate Metrics - Track delivery times for each platform and route
- Request Feedback - Schedule review requests 2-3 days after delivery
- Complete Orders - Mark orders as fully completed in your system
- Reward Customers - Consider loyalty points or next-order discounts
- Monitor Performance - Alert on slow deliveries or multiple attempts
Delivery Time Calculation
function calculateDeliveryMetrics(shipmentData) {
const shipped = new Date(shipmentData.shippedAt);
const delivered = new Date(shipmentData.deliveredAt);
const totalHours = (delivered - shipped) / (1000 * 60 * 60);
const totalDays = Math.floor(totalHours / 24);
const businessDays = calculateBusinessDays(shipped, delivered);
return {
totalHours,
totalDays,
businessDays,
isExpressDelivery: totalHours <= 24,
isStandardDelivery: totalHours <= 72,
isDelayed: totalHours > 120,
};
}Related Events
shipment.created- Initial shipment creationshipment.updated- Status updates during transit
Testing
Test this webhook using the webhook testing tool in your dashboard:
- Navigate to Webhooks → Your Webhook → Test
- Select
shipment.deliveredevent - Send test payload with
deliveredAttimestamp - Verify your handler:
- Sends confirmation emails
- Schedules review requests
- Calculates delivery metrics correctly
Need Help?
- Check the Getting Started Guide for setup instructions
- Review webhook security best practices
- Contact support if you encounter issues