Skip to content

History ​

Read the chats and messages the gateway has stored: the last HISTORY_SYNC_DAYS days imported when the number was linked, plus everything sent and received since. It's the same data the inbox shows.

List chats ​

http
GET /session/:session/chats
Query
qSearch by name, phone number or JID.
filterall (default; archived chats left out), unread, groups or archived.
limitChats per page, 1 to 500. Default 100.
beforeThe next_before of the previous page.
json
{
  "data": [
    {
      "jid": "447700900123@s.whatsapp.net",
      "name": "Emma Wilson",
      "phone": "+447700900123",
      "isGroup": false,
      "unread": 0,
      "lastMessage": "Afternoon is perfect, thanks!",
      "lastMessageFromMe": false,
      "lastMessageAt": 1764584460,
      "archived": false,
      "pinned": true
    }
  ],
  "next_before": "1764500000:14165550142@s.whatsapp.net"
}

Most recent first; pinned chats come first on the first page. next_before is null on the last page.

List messages ​

http
GET /session/:session/chats/:chat/messages

:chat is a phone number (447700900123) or a JID (120363012345678901@g.us for groups).

Query
limitMessages per page, 1 to 500. Default 50.
beforeThe next_before of the previous page, to go further back.

A page holds the newest messages, ordered oldest to newest. next_before is the ID of the oldest message on the page, or null when there's nothing older.

json
{
  "data": [
    {
      "id": "3EB0C4F1A2",
      "fromMe": false,
      "sender": { "jid": "447700900123@s.whatsapp.net", "name": "Emma Wilson" },
      "type": "text",
      "text": "Afternoon is perfect, thanks!",
      "media": null,
      "status": null,
      "reactions": { "me": "❤️" },
      "edited": false,
      "timestamp": 1764584460,
      "quoted": { "id": "3EB0POLL01", "fromMe": true, "sender": null, "preview": "📊 Poll · Which delivery slot works best?" },
      "location": null,
      "contacts": null,
      "poll": null
    }
  ],
  "next_before": "3EB0C4F1A2"
}
Field
senderWho sent it, null for your own messages.
typetext, image, video, audio, document, sticker, location, contact, pollCreation, revoked (deleted), …
media{ kind, mime, name, url } for media messages. Download it from url (see below).
statusYour messages only: pending, server, delivered, read, played or error.
reactionsEmoji per person. me is your own reaction.
quotedThe message this one replies to.
location{ latitude, longitude, name, address }
contacts[{ name, phones }] for contact cards.
poll{ name, multiple, options: [{ name, votes }] }

Download media ​

http
GET /session/:session/chats/:chat/messages/:id/media

Returns the file. It's fetched from WhatsApp on the first request and cached on your server. WhatsApp keeps media for a limited time; when it's gone the response is 410.

Uses the unofficial WhatsApp Web protocol. Not affiliated with WhatsApp or Meta.