Reference

Read messages

Incoming messages are best received with webhooks. These endpoints let you look messages up afterwards.

Tusk WhatsApp API: Read messages

List stored messages

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

Returns messages stored for the session, newest first, with filters.

Parameters
NameTypeDescription
sessionIdrequiredpathThe session id from the sessions endpoints.
chatIdstringOnly messages in this chat.
fromstringOnly messages from this sender.
limitintegerMaximum messages to return. Defaults to 50.
offsetintegerMessages to skip.
afterstringCursor for paging: the id of the last message of the previous page.
inlineMediabooleanSet false to leave out inline media data, and fetch it with the media endpoint instead.
curl "https://api.tuskmail.africa/v1/whatsapp/sessions/$SESSION_ID/messages?chatId=254700000002%40c.us&limit=20" \
  -H "X-API-Key: $TUSK_WA_KEY"
200 OK
{
  "messages": [
    {
      "id": "msg_1",
      "chatId": "[email protected]",
      "from": "[email protected]",
      "to": "[email protected]",
      "body": "Hello",
      "type": "chat",
      "direction": "incoming",
      "timestamp": 1768469400,
      "status": "read",
      "createdAt": "2026-01-15T09:30:00Z"
    }
  ],
  "total": 1
}

Fetch a chat's history

GET/v1/whatsapp/sessions/{sessionId}/messages/{chatId}/history

Fetches recent messages of a chat live from WhatsApp.

Parameters
NameTypeDescription
sessionIdrequiredpathThe session id from the sessions endpoints.
chatIdrequiredpathThe chat id.
limitintegerMaximum messages to return. Defaults to 50.
includeMediabooleanInclude media as base64. Slower. Defaults to false.
deepbooleanRaise the limit ceiling from 100 to 2000 to reach further back. Slower.
curl "https://api.tuskmail.africa/v1/whatsapp/sessions/$SESSION_ID/messages/[email protected]/history?limit=20" \
  -H "X-API-Key: $TUSK_WA_KEY"
200 OK
[
  {
    "id": "3EB0A1B2C3D4E5F60789",
    "from": "[email protected]",
    "to": "[email protected]",
    "chatId": "[email protected]",
    "body": "Hello",
    "type": "text",
    "timestamp": 1768469400,
    "fromMe": false,
    "isGroup": false,
    "kind": "individual"
  }
]

Download a message's media

GET/v1/whatsapp/sessions/{sessionId}/messages/{chatId}/{messageId}/media

Downloads the stored media of a message. The response is the file itself with its content type, not JSON. It returns 404 when no media is stored for the message.

Parameters
NameTypeDescription
sessionIdrequiredpathThe session id from the sessions endpoints.
chatIdrequiredpathThe chat the message is in.
messageIdrequiredpathThe message id.
curl "https://api.tuskmail.africa/v1/whatsapp/sessions/$SESSION_ID/messages/[email protected]/3EB0A1B2C3D4E5F60789/media" \
  -H "X-API-Key: $TUSK_WA_KEY"
200 OK
Binary file