✅ Presence

You can get presence information (online, offline with last seen, typing status) for a contact if they share their presence information.

WhatsApp Typing

FAQ

👉 I don’t get notifications on my phone when WAHA session is connected

  • You need to send offline after all presence you send (WhatsApp doesn’t send notifications to the device if a web client is active).
  • For 🏭 NOWEB Engine also mark sure to send markOnline: false when you create a new session.

Features

Here’s the list of features that are available by 🏭 Engines:

✅ Presence - API
APIWEBJSNOWEBGOWS
POST /api/{session}/presence✔️✔️✔️
GET /api/{session}/presence✔️✔️
GET /api/{session}/presence/{chatId}✔️✔️
POST /api/{session}/presence/{chatId}/subscribe✔️✔️

If you see the feature is not available in the above list, please create a feature request or leave “+1” comment on the existing one.

API

See the list of engines that support the feature ->.

Set presence

You can set your global or chat-related presence with endpoint

POST /api/{session}/presence
Body
{
  "chatId": "111111111@c.us",
  "presence": "typing"
}

Possible presence statuses that you can set or get for chats:

  • online - send the status with no chatId
  • offline - send the status with no chatId
  • typing - chatId required
  • recording - chatId required
  • paused - resets the chat presence after you were typing. chatId required.

Start typing to a chat (you can use POST /startTyping instead)

Body
{
  "chatId": "111111111@c.us",
  "presence": "typing"
}

Clear “typing” state (you can use POST /stopTyping instead)

Body
{
  "chatId": "111111111@c.us",
  "presence": "paused"
}

Set global “online”, all contacts will see it

Body
{
  "presence": "online"
}

💡 In the multi-device version of WhatsApp - if a desktop client is active, WhatsApp doesn’t send push notifications to the device. If you would like to receive said notifications - you need to mark a session’s presence as offline.

Body
{
  "presence": "offline"
}

Get all chats presence

You can get all presence information available for a session by calling

GET /api/{session}/presence

It returns both groups’ and personal chats’ presence information.

Here’s few notes about fields:

  • chatId - either contact id (213213213@c.us) or group chat id (1111111111111@g.us).
  • lastSeen - contains Unix timestamps indicating when a participant was last online
  • lastKnownPresence - contains the last known presence status, which can be offline, online, typing, recording, or paused
Response
[
  {
    "id": "2132132130@c.us",
    "presences": [
      {
        "participant": "2132132130@c.us",
        "lastKnownPresence": "offline",
        "lastSeen": 1686719326
      }
    ]
  },
  {
    "id": "11111111111111111111111@g.us",
    "presences": [
      {
        "participant": "11111111111111111111111@g.us",
        "lastKnownPresence": "online",
        "lastSeen": null
      },
      {
        "participant": "2132132130@c.us",
        "lastKnownPresence": "offline",
        "lastSeen": 1686719326
      }
    ]
  }
]

Get chat presence

To get presence information for a single chat - call GET /api/{session}/presence/{chatId}. For a group, you’ll get participants’ statuses.

Response
{
  "id": "2132132130@c.us",
  "presences": [
    {
      "participant": "2132132130@c.us",
      "lastKnownPresence": "online",
      "lastSeen": null
    }
  ]
}

Subscribe to presence

You can subscribe to presence information by calling

POST /api/{session}/presence/{chatId}/subscribe

(no body required).

You can get later presence information for the chat with above GET endpoints or by listening to presence.update webhook.

Events

Read more about 🔄 Events.

presence.update

You can subscribe to presence.update webhook event to get the most recent presence information.

presence.update
{
    "event": "presence.update",
    "session": "default",
    "payload": {
        "id": "111111111111111111@g.us",
        "presences": [
            {
                "participant": "11111111111@c.us",
                "lastKnownPresence": "typing",
                "lastSeen": null
            }
        ]
    },
    "engine": "NOWEB"
}