Appearance
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:readPath 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
| Name | Type | Required | Description |
|---|---|---|---|
channel | integer | yes | WhatsApp QR Code channel id |
chatId | string | yes | Chat id (…@c.us, …@lid, …@g.us) or a phone number. See chat ids. |
Main response fields
| Field | Type | Description |
|---|---|---|
id | string | WhatsApp message id |
timestamp | integer | Unix timestamp (seconds) |
from | string | Sender chat id. In groups this is the group id. |
participant | string | In groups, the member who sent the message |
fromMe | boolean | true when the channel's number sent it |
body | string | null | Text or caption |
hasMedia | boolean | true for image, video, audio, voice and document messages |
media.url | string | Internal file link. Pass it as path to Download media; it doesn't open directly. |
media.mimetype | string | e.g. image/jpeg, audio/ogg; codecs=opus |
media.filename | string | null | Original file name, for documents |
ack, ackName | integer, string | Delivery status: ERROR, PENDING, SERVER, DEVICE, READ or PLAYED |
replyTo | object | null | The message this one replies to |
_data | object | Raw 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=1791200000Only messages from after the number was connected to Genudo are available.