Reference

Chats

Chats are your conversations with people and groups. A chat’s id is the chat id used everywhere else. See chat ids.

Tusk WhatsApp API: Chats

List chats

GET/v1/whatsapp/sessions/{sessionId}/chats

Returns recent chats.

Parameters
NameTypeDescription
sessionIdrequiredpathThe session id from the sessions endpoints.
limitintegerMaximum chats to return, from 1 to 1000. Defaults to 1000.
offsetintegerNumber of chats to skip, for paging.
curl "https://api.tuskmail.africa/v1/whatsapp/sessions/$SESSION_ID/chats?limit=20" \
  -H "X-API-Key: $TUSK_WA_KEY"
200 OK
[
  {
    "id": "[email protected]",
    "name": "Amina",
    "isGroup": false,
    "kind": "individual",
    "unreadCount": 2,
    "timestamp": 1768469400,
    "lastMessage": "Thanks!",
    "archived": false,
    "pinned": false,
    "muted": false
  }
]

Mark a chat as read

POST/v1/whatsapp/sessions/{sessionId}/chats/read

Marks a chat, or specific messages in it, as read.

Body
NameTypeDescription
sessionIdrequiredpathThe session id from the sessions endpoints.
chatIdrequiredstringThe chat to mark as read.
messageIdsstring[]Specific message ids. Omit to mark the whole chat.
curl -X POST "https://api.tuskmail.africa/v1/whatsapp/sessions/$SESSION_ID/chats/read" \
  -H "X-API-Key: $TUSK_WA_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "chatId": "[email protected]"
}'
200 OK
{
  "success": true
}

Show typing or recording

POST/v1/whatsapp/sessions/{sessionId}/chats/typing

Shows a typing or recording indicator in a chat, or clears it with paused. Handy while a human or a bot prepares a reply.

Body
NameTypeDescription
sessionIdrequiredpathThe session id from the sessions endpoints.
chatIdrequiredstringThe chat to show the indicator in.
staterequiredstringOne of typing, recording or paused.
curl -X POST "https://api.tuskmail.africa/v1/whatsapp/sessions/$SESSION_ID/chats/typing" \
  -H "X-API-Key: $TUSK_WA_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "chatId": "[email protected]",
  "state": "typing"
}'
200 OK
{
  "success": true
}