LetsBot Meny
Kom igång Svenska Språk

Meta Business Partner Registrerat företag i Storbritannien

Språk

Chat · API-endpoint

GET /api/v1/chat/conversation

Get chat conversation for phone

Get the conversation with one phone number from the WhatsApp session, newest first.

Get the conversation with one phone number from the WhatsApp session, newest first. Page with limit, then pass the last message's id as cursorId and its direction as cursorFromMe.

Channels: QR (WhatsApp Web) channels only. On an official WhatsApp Cloud API number this request answers 409 with "error_code": "USE_MESSAGES_ARCHIVE" and a ready-made use.example URL — call that instead.

To read stored messages on any channel, use Message Archive → Get messages by date with phone=<number>.

Frågeparametrar

ParameterObligatoriskExempelBeskrivning
phone Ja {{phone2}}
limit Ja 25
cursorId Ja REDACTED
cursorFromMe Ja true

Exempelanrop

curl -G "https://letsbot.net/api/v1/chat/conversation" \
  -H "Authorization: Bearer YOUR_LB_API_KEY" \
  -H "Accept: application/json" \
  --data-urlencode "phone={{phone2}}" \
  --data-urlencode "limit=25" \
  --data-urlencode "cursorId=REDACTED" \
  --data-urlencode "cursorFromMe=true"
const response = await fetch("https://letsbot.net/api/v1/chat/conversation?phone=%7B%7Bphone2%7D%7D&limit=25&cursorId=REDACTED&cursorFromMe=true", {
  method: "GET",
  headers: {
    "Authorization": "Bearer YOUR_LB_API_KEY",
    "Accept": "application/json",
  },
});

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

$ch = curl_init('https://letsbot.net/api/v1/chat/conversation?phone=%7B%7Bphone2%7D%7D&limit=25&cursorId=REDACTED&cursorFromMe=true');

curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer YOUR_LB_API_KEY',
        'Accept: application/json',
    ],
]);

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

print_r($data);
import requests

response = requests.request(
    "GET",
    "https://letsbot.net/api/v1/chat/conversation",
    headers={
        "Authorization": "Bearer YOUR_LB_API_KEY",
        "Accept": "application/json",
    },
    params={
        "phone": "{{phone2}}",
        "limit": "25",
        "cursorId": "REDACTED",
        "cursorFromMe": "true",
    },
)

print(response.json())

Svar

success response200
(tomt innehåll)
409 — official number409
{
    "success": false,
    "Status": false,
    "error_code": "USE_MESSAGES_ARCHIVE",
    "Message": "GET /api/v1/chat/conversation reads a QR (WhatsApp Web) session, which official WhatsApp Cloud API numbers do not have. Read stored messages — incoming and outgoing — with GET /api/v1/messages (date_from, date_to, optional phone, cursor).",
    "use": {
        "method": "GET",
        "path": "/api/v1/messages",
        "example": "/api/v1/messages?phone=966512345678&date_from=2026-08-31&date_to=2026-09-30"
    }
}

Redo när du är det

Testa den här endpointen med ditt eget nummer

API:t fungerar under gratisperioden. Skapa ett konto, anslut ditt WhatsApp-nummer och kopiera din nyckel under API → Autentiseringsdata.