Getting Started
Build your first integration in less than 15 minutes
Last updated
Was this helpful?
Was this helpful?
{
"id": 1,
"orderNumber": "ORD-1751999768784",
"customerName": "Sarah Johnson",
"customerEmail": "sarah@example.com",
"status": "pending",
"total": "234.50",
"shippingAddressLine1": "123 Main Street",
"shippingAddressLine2": "Apt 4B",
"shippingCity": "New York",
"shippingState": "NY",
"shippingZipCode": "10001",
"shippingCountry": "US",
"createdAt": "2025-01-08T18:36:08.000Z",
"updatedAt": "2025-01-08T18:36:08.000Z",
"items": [
{
"id": 1,
"orderId": 1,
"productId": 1,
"quantity": 2,
"price": "129.99",
"product": {
"id": 1,
"name": "Wireless Earbuds Pro",
"sku": "WEP-001",
"category": "Electronics",
"price": "129.99",
"stock": 25,
"status": "active",
"description": "High-quality wireless earbuds",
"imageUrl": "https://images.unsplash.com/photo-1572569511254-d8f925fe2cbb"
}
}
]
}{
"id": 5,
"orderNumber": "ORD-1752204924208",
"customerName": "Lisa Chen",
"customerEmail": "lisa.chen@email.com",
"status": "pending",
"total": "299.99",
"shippingAddressLine1": "789 Oak Drive",
"shippingAddressLine2": "Unit 5",
"shippingCity": "Seattle",
"shippingState": "WA",
"shippingZipCode": "98101",
"shippingCountry": "US",
"trackingUrl": null,
"shipmentReferenceId": null,
"createdAt": "2025-07-11T03:35:24.196Z",
"updatedAt": "2025-07-11T03:35:24.208Z",
"items": [
{
"id": 9,
"orderId": 5,
"productId": 2,
"quantity": 1,
"price": 299.99,
"product": {
"id": 2,
"name": "Smart Watch Series X",
"sku": "SWX-002",
"category": "Electronics",
"price": 299.99,
"stock": 12,
"status": "active",
"description": "Advanced smartwatch with health monitoring",
"imageUrl": "https://images.unsplash.com/photo-1523275335684-37898b6baf30?ixlib=rb-4.0.3&auto=format&fit=crop&w=96&h=96",
"createdAt": "2025-07-08T18:36:08.439Z",
"updatedAt": "2025-07-08T18:36:08.446Z"
}
}
]
}{
"customer_name": "Lisa Chen",
"customer_email": "lisa.chen@email.com",
"customer_phone": "+1234567890",
"shipping_address": {
"street": "789 Oak Drive Unit 5",
"city": "Seattle",
"state": "WA",
"zip": "98101",
"country": "US"
},
"items": [
{
"sku": "SWX-002",
"name": "Smart Watch Series X",
"quantity": 1,
"price": 299.99
}
],
"shipping_method": "standard"
}(data) => {
const inputOrder = data.input;
// Use Array.map to transform the items array
const transformedItems = inputOrder.items.map(item => ({
sku: item.product.sku,
name: item.product.name,
quantity: item.quantity,
price: parseFloat(item.price) // Convert price from string to number
}));
// Construct the final output object
const outputOrder = {
customer_name: inputOrder.customerName,
customer_email: inputOrder.customerEmail,
customer_phone: "+1234567890", // Placeholder as source data is missing
shipping_address: {
street: `${inputOrder.shippingAddressLine1 || ''} ${inputOrder.shippingAddressLine2 || ''}`.trim(),
city: inputOrder.shippingCity,
state: inputOrder.shippingState,
zip: inputOrder.shippingZipCode,
country: inputOrder.shippingCountry
},
items: transformedItems,
shipping_method: "standard" // Default value as source data is missing
};
return outputOrder;
}(data) => {
// The body of the request is the output from the previous step (step_1)
const requestBody = data.step_1.data;
return {
"lam.httpRequest": {
"method": "POST",
"url": "https://shipping-logistics-loic21.replit.app/api/orders",
"headers": {
"Content-Type": "application/json"
},
"body": requestBody
}
};
}(data) => {
// Get the order ID from the initial workflow input
const orderId = data.input.id;
// Get the tracking URL and number from the response of the previous step (step_2)
const tracking_url = data.step_2.response.tracking_url
const tracking_number = data.step_2.response.tracking_number
return {
"lam.httpRequest": {
"method": "PUT",
"url": `https://order-track-pro-loic21.replit.app/api/orders/${orderId}`,
"headers": {
"Content-Type": "application/json"
},
"body": {
"status": "Processing",
"tracking_url": tracking_url,
"shipment_reference_id": tracking_number,
}
}
};
}{
"id": 5,
"orderNumber": "ORD-1752204924208",
"customerName": "Lisa Chen",
"customerEmail": "lisa.chen@email.com",
"status": "pending",
"total": "299.99",
"shippingAddressLine1": "789 Oak Drive",
"shippingAddressLine2": "Unit 5",
"shippingCity": "Seattle",
"shippingState": "WA",
"shippingZipCode": "98101",
"shippingCountry": "US",
"trackingUrl": null,
"shipmentReferenceId": null,
"createdAt": "2025-07-11T03:35:24.196Z",
"updatedAt": "2025-07-11T03:35:24.208Z",
"items": [
{
"id": 9,
"orderId": 5,
"productId": 2,
"quantity": 1,
"price": 299.99,
"product": {
"id": 2,
"name": "Smart Watch Series X",
"sku": "SWX-002",
"category": "Electronics",
"price": 299.99,
"stock": 12,
"status": "active",
"description": "Advanced smartwatch with health monitoring",
"imageUrl": "https://images.unsplash.com/photo-1523275335684-37898b6baf30?ixlib=rb-4.0.3&auto=format&fit=crop&w=96&h=96",
"createdAt": "2025-07-08T18:36:08.439Z",
"updatedAt": "2025-07-08T18:36:08.446Z"
}
}
]
}