Developer
Order Created Event
Documentation for the order.created webhook event
The order.created event is triggered whenever a new order is successfully created in the system.
Event Type
order.createdWhen It's Triggered
This event is sent when:
- A customer completes a new order through any platform (Messenger, WhatsApp, etc.)
- An order is manually created by an admin or staff member
- An order is created via API
Webhook Payload Structure
{
"event": "order.created",
"timestamp": "2026-02-15T10:30:00.000Z",
"data": {
"orderGroupId": "og_abc123xyz",
"orderGroupCode": "ORD-2026-001",
"deliveryCharge": 50,
"advancedPayment": 500,
"advancedPaymentId": "pay_xyz789",
"customer": {
"id": "cust_123",
"name": "John Doe",
"email": "john@example.com",
"phoneNumber": "+1234567890",
"shippingAddress": "123 Main St, City, Country"
},
"status": "PENDING",
"paymentMethods": [{ "id": "pm_abc1", "name": "bKash" }],
"purchaseIntent": "READY_TO_BUY",
"platform": "MESSENGER",
"facebookPageId": "page_123",
"whatsappAccountId": null,
"totalQuantity": 3,
"orderCount": 2,
"createdAt": "2026-02-15T10:30:00.000Z",
"updatedAt": "2026-02-15T10:30:00.000Z",
"dateTime": "2026-02-15T10:30:00.000Z",
"notes": "Customer prefers morning delivery",
"orders": [
{
"id": "item_1",
"productId": "prod_abc",
"productName": "Wireless Headphones",
"variant": "Black",
"quantity": 2,
"extra": {
"color": "Midnight Black",
"engraving": "John D."
},
"productImages": ["https://example.com/image1.jpg"],
"product": {
"id": "prod_abc",
"name": "Wireless Headphones",
"retailPrice": 2500,
"wholesalePrice": 2000,
"soldPrice": 2300,
"description": "Premium wireless headphones with noise cancellation",
"images": ["https://example.com/image1.jpg"]
}
}
]
}
}Field Descriptions
Root Level
| Field | Type | Description |
|---|---|---|
event | string | Always "order.created" for this event |
timestamp | string | ISO 8601 timestamp when the webhook was sent |
data | object | The order data object (see below) |
Data Object
| Field | Type | Required | Description |
|---|---|---|---|
orderGroupId | string | Yes | Unique identifier for the order group |
orderGroupCode | string | No | Human-readable order code (e.g., "ORD-2026-001") |
deliveryCharge | number | No | Delivery fee charged for this order |
advancedPayment | number | No | Amount paid in advance |
advancedPaymentId | string | No | Reference ID for the advance payment |
customer | object | Yes | Customer information (see below) |
status | string | Yes | Order status (see Status Values) |
paymentMethods | array | Yes | Custom payment methods assigned to this order (see Payment Methods) |
purchaseIntent | string | Yes | Customer's purchase intent (see Purchase Intent) |
platform | string | Yes | Platform where order originated (see Platforms) |
facebookPageId | string | No | Facebook Page ID (if platform is MESSENGER) |
whatsappAccountId | string | No | WhatsApp Account ID (if platform is WHATSAPP) |
totalQuantity | number | Yes | Total quantity of all items in the order |
orderCount | number | Yes | Number of distinct product line items |
createdAt | string | Yes | ISO 8601 timestamp when order was created |
updatedAt | string | Yes | ISO 8601 timestamp of last update |
dateTime | string | Yes | ISO 8601 timestamp of the order (may differ from createdAt) |
notes | string | No | Additional notes or special instructions |
orders | array | Yes | Array of order items (see below) |
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 (E.164 format recommended) |
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 (e.g., "Black", "Large", "Blue XL") |
quantity | number | Yes | Quantity of this item ordered |
extra | object | No | Custom key-value properties for this item (e.g. {"color": "red", "engraving": "John"}). Empty object {} when no custom properties are set. |
productImages | array | No | Array of image URLs for this product |
product | object | No | Full product details (see below) |
Product Object
| Field | Type | Description |
|---|---|---|
id | string | Product identifier |
name | string | Product name |
retailPrice | number | Retail price per unit |
wholesalePrice | number | Wholesale price per unit |
soldPrice | number | Actual price the customer paid for this item (may differ from retail/wholesale due to discounts or custom pricing) |
description | string | Product description |
images | array | Array of product image URLs |
Enum Values
Status Values
PENDING- Order is pending processingPROCESSING- Order is being preparedSHIPPED- Order has been shippedDELIVERED- Order has been deliveredCANCELLED- Order was cancelledRETURNED- Order was returned
Payment Methods
paymentMethods is an array of objects, each with:
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier of the payment method |
name | string | Display name (e.g. "bKash", "COD") |
Payment methods are org-defined and managed at /dashboard/payment-methods. An empty array means no payment method was assigned.
Purchase Intent
BROWSING- Customer is browsing productsINTERESTED- Customer has shown interestREADY_TO_BUY- Customer is ready to purchasePURCHASED- Purchase completed
Platforms
MESSENGER- Facebook MessengerWHATSAPP- WhatsAppWEB- Web interfaceAPI- API integration
Example Handler
Node.js/Express
app.post('/webhooks/orders', async (req, res) => {
const { event, timestamp, data } = req.body;
if (event === 'order.created') {
console.log(`New order created: ${data.orderGroupCode}`);
console.log(`Customer: ${data.customer.name}`);
console.log(`Total items: ${data.totalQuantity}`);
console.log(`Status: ${data.status}`);
// Process the new order
await createOrderInSystem(data);
// Send confirmation email
if (data.customer.email) {
await sendOrderConfirmation(data.customer.email, data);
}
// Update inventory
for (const item of data.orders) {
await updateInventory(item.productId, -item.quantity);
}
// Notify fulfillment team
await notifyFulfillment(data);
}
res.status(200).json({ received: true });
});Python/Flask
@app.route('/webhooks/orders', methods=['POST'])
def webhook():
payload = request.json
event = payload['event']
data = payload['data']
if event == 'order.created':
print(f"New order created: {data['orderGroupCode']}")
print(f"Customer: {data['customer']['name']}")
print(f"Total items: {data['totalQuantity']}")
# Process the new order
create_order_in_system(data)
# Send confirmation email
if data['customer'].get('email'):
send_order_confirmation(data['customer']['email'], data)
# Update inventory
for item in data['orders']:
update_inventory(item['productId'], -item['quantity'])
# Notify fulfillment team
notify_fulfillment(data)
return jsonify({'received': True}), 200Common Use Cases
1. Inventory Management
Update your inventory when new orders are created:
async function handleOrderCreated(orderData) {
for (const item of orderData.orders) {
await db.inventory.decrement({
where: { productId: item.productId },
data: { quantity: item.quantity },
});
// Check if low stock
const product = await db.inventory.findUnique({
where: { productId: item.productId },
});
if (product.quantity < 10) {
await notifyLowStock(product);
}
}
}2. Order Notifications
Send notifications to customers and staff:
async function handleOrderCreated(orderData) {
// Notify customer
if (orderData.customer.email) {
await emailService.send({
to: orderData.customer.email,
template: 'order-confirmation',
data: orderData,
});
}
if (orderData.customer.phoneNumber) {
await smsService.send({
to: orderData.customer.phoneNumber,
message: `Your order ${orderData.orderGroupCode} has been received!`,
});
}
// Notify fulfillment team
await slackService.send({
channel: '#orders',
message: `New order: ${orderData.orderGroupCode} - ${orderData.totalQuantity} items`,
});
}3. Analytics and Reporting
Track order metrics:
async function handleOrderCreated(orderData) {
await analytics.track({
event: 'Order Created',
properties: {
orderId: orderData.orderGroupId,
revenue: calculateRevenue(orderData),
itemCount: orderData.totalQuantity,
platform: orderData.platform,
paymentMethods: orderData.paymentMethods.map((m) => m.name).join(', '),
},
});
}4. Fraud Detection
Implement fraud checks for new orders:
async function handleOrderCreated(orderData) {
const riskScore = await fraudDetection.analyze({
customerEmail: orderData.customer.email,
phoneNumber: orderData.customer.phoneNumber,
orderValue: calculateTotal(orderData),
shippingAddress: orderData.customer.shippingAddress,
});
if (riskScore > 0.8) {
await flagForReview(orderData.orderGroupId);
await notifyFraudTeam(orderData, riskScore);
}
}