Skip to content

List messages ​

Returns the messages of one chat, newest first. Media is downloaded for you; get the file with Download media.

GET/api/user/whatsapp-qr/channels/{channel}/chats/{chatId}/messages
Required scope: whatsapp-qr:read
Path parameters
integer
string
Query parameters
integer
integer
integer
curl -X GET "https://loopx-console.test/api/user/whatsapp-qr/channels/105/chats/201066278084%40c.us/messages?limit=20&offset=0" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Accept: application/json"
<?php

use GuzzleHttp\Client;

$client = new Client();
$response = $client->request('GET', 'https://loopx-console.test/api/user/whatsapp-qr/channels/105/chats/201066278084%40c.us/messages?limit=20&offset=0', [
    'headers' => [
        'Authorization' => 'Bearer $TOKEN',
        'Accept'        => 'application/json',
    ]
]);

$data = json_decode($response->getBody(), true);
const res = await fetch('https://loopx-console.test/api/user/whatsapp-qr/channels/105/chats/201066278084%40c.us/messages?limit=20&offset=0', {
  method: 'GET',
  headers: {
    Authorization: 'Bearer $TOKEN',
    Accept: 'application/json'
  }
});

const data = await res.json();

Example response

{
  "status": true,
  "code": 200,
  "validation": [],
  "message": "Messages",
  "data": [
    {
      "id": "false_25318949687344@lid_3AEF0449C153977B1897",
      "timestamp": 1791204698,
      "from": "25318949687344@lid",
      "fromMe": false,
      "source": "app",
      "body": null,
      "hasMedia": true,
      "media": {
        "url": "http://localhost:3000/api/s3/genudo-whatsapp-media/development-whatsapp-105/3AEF0449C153977B1897.oga",
        "filename": null,
        "mimetype": "audio/ogg; codecs=opus",
        "s3": {
          "Bucket": "genudo-whatsapp-media",
          "Key": "development-whatsapp-105/3AEF0449C153977B1897.oga"
        }
      },
      "ack": 2,
      "ackName": "DEVICE",
      "location": null,
      "vCards": null,
      "replyTo": null,
      "_data": {
        "key": {
          "remoteJid": "25318949687344@lid",
          "remoteJidAlt": "201066278084@s.whatsapp.net",
          "fromMe": false,
          "id": "3AEF0449C153977B1897"
        },
        "pushName": "Mahmoud Ahmed",
        "message": {
          "audioMessage": {
            "seconds": 1,
            "ptt": true
          }
        }
      }
    }
  ]
}

Path parameters ​

NameTypeRequiredDescription
channelintegeryesWhatsApp QR Code channel id
chatIdstringyesChat id (…@c.us, …@lid, …@g.us) or a phone number. See chat ids.

Main response fields ​

FieldTypeDescription
idstringWhatsApp message id
timestampintegerUnix timestamp (seconds)
fromstringSender chat id. In groups this is the group id.
participantstringIn groups, the member who sent the message
fromMebooleantrue when the channel's number sent it
bodystring | nullText or caption
hasMediabooleantrue for image, video, audio, voice and document messages
media.urlstringInternal file link. Pass it as path to Download media; it doesn't open directly.
media.mimetypestringe.g. image/jpeg, audio/ogg; codecs=opus
media.filenamestring | nullOriginal file name, for documents
ack, ackNameinteger, stringDelivery status: ERROR, PENDING, SERVER, DEVICE, READ or PLAYED
replyToobject | nullThe message this one replies to
_dataobjectRaw WhatsApp message data. For example, _data.key.remoteJidAlt has the phone number of a @lid contact.

Paginating ​

Use offset, or pass the timestamp of the oldest message you have as before:

GET …/chats/201066278084@c.us/messages?limit=50
GET …/chats/201066278084@c.us/messages?limit=50&before=1791200000

Only messages from after the number was connected to Genudo are available.