LetsBot Menu
Bắt đầu Tiếng Việt Ngôn ngữ

Đối tác kinh doanh của Meta Công ty đăng ký tại Vương quốc Anh

Ngôn ngữ

Orders (order journey) · Endpoint API

POST /api/v1/orders Mới

Record an order

Records an order from your own store system (not Salla / Zid) and starts its order journey: every active automation reminder on «Order placed» (panel…

Records an order from your own store system (not Salla / Zid) and starts its order journey: every active automation reminder on «Order placed» (panel → Automation reminders) goes to this customer N days after ordered_at — rating request, discount, marketing.

Required: order_id (letters, digits, ., _, -; max 64) and phone (international format, e.g. 966501234567). Optional: customer_name, ordered_at (ISO-8601, within the last 365 days, not in the future; default now), total, currency, order_url (https), store_name, language (ar, en, es, pt), invoice_number, invoice_url (https page) or invoice_pdf_url (https PDF), products (up to 20, each name + optional https url).

When invoice_url or invoice_pdf_url is sent, the invoice goes out at once, once per order, through your invoice templates (panel → Invoices). Recording an order sends nothing else by itself.

journey.reachable is false when this customer never wrote to you and your number is QR-linked: journey messages will not reach them (cold messages go out only from an official Cloud API number). invoice is one of not_requested, sent, skipped, failed, duplicate, off.

Answers 201 when recorded, 422 on validation errors ({"Status": false, "Message": ..., "errors": {...}}), 403 when no workspace is linked to the key, 409 while a new workspace is still being prepared.

Nội dung JSON

{
  "order_id": "ORD-1042",
  "phone": "966501234567",
  "customer_name": "Sara",
  "ordered_at": "2026-10-20T14:30:00+03:00",
  "total": 249.5,
  "currency": "SAR",
  "order_url": "https://shop.example.com/orders/ORD-1042",
  "store_name": "Example Store",
  "language": "ar",
  "invoice_number": "INV-1042",
  "invoice_pdf_url": "https://shop.example.com/invoices/INV-1042.pdf",
  "products": [
    {
      "name": "Arabic coffee 500g",
      "url": "https://shop.example.com/p/coffee"
    }
  ]
}

Ví dụ yêu cầu

curl -X POST "https://letsbot.net/api/v1/orders" \
  -H "Authorization: Bearer YOUR_LB_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
  "order_id": "ORD-1042",
  "phone": "966501234567",
  "customer_name": "Sara",
  "ordered_at": "2026-10-20T14:30:00+03:00",
  "total": 249.5,
  "currency": "SAR",
  "order_url": "https://shop.example.com/orders/ORD-1042",
  "store_name": "Example Store",
  "language": "ar",
  "invoice_number": "INV-1042",
  "invoice_pdf_url": "https://shop.example.com/invoices/INV-1042.pdf",
  "products": [
    {
      "name": "Arabic coffee 500g",
      "url": "https://shop.example.com/p/coffee"
    }
  ]
}'
const response = await fetch("https://letsbot.net/api/v1/orders", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_LB_API_KEY",
    "Accept": "application/json",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "order_id": "ORD-1042",
    "phone": "966501234567",
    "customer_name": "Sara",
    "ordered_at": "2026-10-20T14:30:00+03:00",
    "total": 249.5,
    "currency": "SAR",
    "order_url": "https://shop.example.com/orders/ORD-1042",
    "store_name": "Example Store",
    "language": "ar",
    "invoice_number": "INV-1042",
    "invoice_pdf_url": "https://shop.example.com/invoices/INV-1042.pdf",
    "products": [
      {
        "name": "Arabic coffee 500g",
        "url": "https://shop.example.com/p/coffee"
      }
    ]
  }),
});

const data = await response.json();
console.log(data);
<?php

$ch = curl_init('https://letsbot.net/api/v1/orders');

curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer YOUR_LB_API_KEY',
        'Accept: application/json',
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => <<<'JSON'
    {
        "order_id": "ORD-1042",
        "phone": "966501234567",
        "customer_name": "Sara",
        "ordered_at": "2026-10-20T14:30:00+03:00",
        "total": 249.5,
        "currency": "SAR",
        "order_url": "https://shop.example.com/orders/ORD-1042",
        "store_name": "Example Store",
        "language": "ar",
        "invoice_number": "INV-1042",
        "invoice_pdf_url": "https://shop.example.com/invoices/INV-1042.pdf",
        "products": [
            {
                "name": "Arabic coffee 500g",
                "url": "https://shop.example.com/p/coffee"
            }
        ]
    }
    JSON,
]);

$data = json_decode(curl_exec($ch), true);
curl_close($ch);

print_r($data);
import requests

response = requests.request(
    "POST",
    "https://letsbot.net/api/v1/orders",
    headers={
        "Authorization": "Bearer YOUR_LB_API_KEY",
        "Accept": "application/json",
        "Content-Type": "application/json",
    },
    json={
        "order_id": "ORD-1042",
        "phone": "966501234567",
        "customer_name": "Sara",
        "ordered_at": "2026-10-20T14:30:00+03:00",
        "total": 249.5,
        "currency": "SAR",
        "order_url": "https://shop.example.com/orders/ORD-1042",
        "store_name": "Example Store",
        "language": "ar",
        "invoice_number": "INV-1042",
        "invoice_pdf_url": "https://shop.example.com/invoices/INV-1042.pdf",
        "products": [
            {
                "name": "Arabic coffee 500g",
                "url": "https://shop.example.com/p/coffee",
            },
        ],
    },
)

print(response.json())

Phản hồi

Order recorded201
{
  "Status": true,
  "Message": "Order recorded.",
  "order_id": "ORD-1042",
  "journey": {
    "recorded": true,
    "ordered_at": "2026-10-20T14:30:00+03:00",
    "reachable": true
  },
  "invoice": "sent"
}
Validation error422
{
  "Status": false,
  "Message": "The order id field is required.",
  "errors": {
    "order_id": [
      "The order id field is required."
    ]
  }
}

Sẵn sàng khi bạn sẵn sàng

Dùng thử endpoint này với số của bạn

API hoạt động trong thời gian dùng thử miễn phí. Tạo tài khoản, kết nối số WhatsApp và sao chép khóa của bạn tại API → Dữ liệu xác thực.