WAHooks
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

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token. Format: Bearer <token>

Path Parameters

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the connection.

Query Parameters

ParameterTypeDefaultDescription
limitnumber50Chats per page, at most 100.
offsetnumber0Chats to skip, for paging.
unread_onlybooleanfalseOnly chats marked unread or with unread mentions.

Response

200 OK
[
  {
    "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.

401 Unauthorized
{
  "statusCode": 401,
  "message": "Unauthorized"
}
404 Not Found
{
  "statusCode": 404,
  "message": "Connection not found"
}
502 Bad Gateway
{
  "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.

On this page