LetsBot Menu
Kom i gang Dansk Sprog

Meta Business Partner Registreret selskab i Storbritannien

Sprog

Messages · API-endpoint

GET /api/v1/message/fetch

Fetch messages

Fetch the most recent messages of the WhatsApp session (limit, default 25).

Fetch the most recent messages of the WhatsApp session (limit, default 25). No date filter.

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.

To read stored messages by date — incoming and outgoing, on any channel — use Message Archive → Get messages by date.

Eksempel på forespørgsel

curl -G "https://letsbot.net/api/v1/message/fetch" \
  -H "Authorization: Bearer YOUR_LB_API_KEY" \
  -H "Accept: application/json"
const response = await fetch("https://letsbot.net/api/v1/message/fetch", {
  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/message/fetch');

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/message/fetch",
    headers={
        "Authorization": "Bearer YOUR_LB_API_KEY",
        "Accept": "application/json",
    },
)

print(response.json())

Svar

Fetch Messages200
(tomt indhold)
409 — official number409
{
    "success": false,
    "Status": false,
    "error_code": "USE_MESSAGES_ARCHIVE",
    "Message": "GET /api/v1/message/fetch 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"
    }
}

Klar, når du er

Prøv dette endpoint med dit eget nummer

API'et virker i den gratis prøveperiode. Opret en konto, forbind dit WhatsApp-nummer, og kopiér din nøgle under API → Godkendelsesdata.