Skip to content

Get Chat Presence ​

Get presence information for a specific chat. For a group, you will get participants' statuses.

Usage ​

php
use NjoguAmos\Waha\Facades\Presence;

/** @var \Saloon\Http\Response $response */
$response = Presence::get(chatId: '1234567890@c.us');
php
use NjoguAmos\Waha\Facades\Presence;

/** @var \Saloon\Http\Response $response */
$response = Presence::get(chatId: '1234567890@c.us', session: 'my-session');

Response ​

The response returned by the get method is an instance of Saloon\Http\Response. You may use the json method to retrieve the response as an array or the dtoOrFail method to retrieve a ChatPresenceData DTO:

php
/** @var \Saloon\Http\Response $response */

$response->status(); // 200
$response->json();   // ["id" => "1234567890@c.us", "presences" => [...]]
php
use NjoguAmos\Waha\Facades\Presence;
use NjoguAmos\Waha\Dto\ChatPresenceData;

/** @var ChatPresenceData $chatPresence */
$chatPresence = Presence::get(chatId: '1234567890@c.us')->dtoOrFail();

$chatPresence->id;                    // "1234567890@c.us"
$chatPresence->presences[0]->participant;        // "1234567890@c.us"
$chatPresence->presences[0]->lastKnownPresence;  // "online"
$chatPresence->presences[0]->lastSeen;           // null or unix timestamp

Engines ​

WEBJSWPPNOWEBGOWS
✅✅✅✅

References ​

Released under the MIT License.