API ReferenceConnections
List Chats
Retrieve recent WhatsApp chats for a connection.
GET /api/connections/{id}/chats
Returns the connection's WhatsApp chats, most recent first. A connection that isn't connected returns an empty list.
Authentication
| Header | Type | Required | Description |
|---|---|---|---|
Authorization | string | Yes | Bearer token. Format: Bearer <token> |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The unique identifier of the connection. |
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
limit | number | 50 | Chats per page, at most 100. |
offset | number | 0 | Chats to skip, for paging. |
unread_only | boolean | false | Only chats marked unread or with unread mentions. |
Response
[
{
"id": "1122334455-1600000000@g.us",
"name": "Team Chat",
"picture": "https://pps.whatsapp.net/v/t61/...",
"isGroup": true,
"lastMessage": { "body": "See you at 3", "timestamp": 1710410700, "fromMe": false },
"unread": true
},
{
"id": "1234567890@c.us",
"name": "John Doe",
"picture": null,
"isGroup": false,
"lastMessage": { "body": "Thanks!", "timestamp": 1710407100, "fromMe": true },
"unread": false
}
]picture is the chat's profile or group picture when WhatsApp has one cached for the connection, otherwise null.
{
"statusCode": 401,
"message": "Unauthorized"
}{
"statusCode": 404,
"message": "Connection not found"
}{
"statusCode": 502,
"message": "Couldn't load chats from WhatsApp. Try again."
}A connected connection whose chats can't be loaded returns 502, never an empty list, so an empty list always means there are no chats.