LetsBot Menu
Começar Português Idioma

Meta Business Partner Empresa registrada no Reino Unido

Idioma

Orders (order journey) · Endpoint da API

POST /api/v1/orders/{orderId}/cancel Novo

Cancel an order (stop its journey)

Stops the order journey for a cancelled or refunded order: no further journey messages are sent for it.

Stops the order journey for a cancelled or refunded order: no further journey messages are sent for it. Send the same customer phone used when the order was recorded. cancelled is false when no open order matches this id and phone.

Corpo JSON

{
  "phone": "966501234567"
}

Exemplo de requisição

curl -X POST "https://letsbot.net/api/v1/orders/ORD-1042/cancel" \
  -H "Authorization: Bearer YOUR_LB_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
  "phone": "966501234567"
}'
const response = await fetch("https://letsbot.net/api/v1/orders/ORD-1042/cancel", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_LB_API_KEY",
    "Accept": "application/json",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "phone": "966501234567"
  }),
});

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

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

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'
    {
        "phone": "966501234567"
    }
    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/ORD-1042/cancel",
    headers={
        "Authorization": "Bearer YOUR_LB_API_KEY",
        "Accept": "application/json",
        "Content-Type": "application/json",
    },
    json={
        "phone": "966501234567",
    },
)

print(response.json())

Respostas

Cancelled200
{
  "Status": true,
  "Message": "No further messages will be sent for this order.",
  "cancelled": true
}
No open order200
{
  "Status": true,
  "Message": "No open order with this id and phone.",
  "cancelled": false
}

Prontos quando você estiver

Teste este endpoint com o seu próprio número

A API funciona durante o teste grátis. Crie uma conta, conecte seu número de WhatsApp e copie sua chave em API → Dados de autenticação.