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: '[email protected]');
php
use NjoguAmos\Waha\Facades\Presence;

/** @var \Saloon\Http\Response $response */
$response = Presence::get(chatId: '[email protected]', 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" => "[email protected]", "presences" => [...]]
php
use NjoguAmos\Waha\Facades\Presence;
use NjoguAmos\Waha\Dto\ChatPresenceData;

/** @var ChatPresenceData $chatPresence */
$chatPresence = Presence::get(chatId: '[email protected]')->dtoOrFail();

$chatPresence->id;                    // "[email protected]"
$chatPresence->presences[0]->participant;        // "[email protected]"
$chatPresence->presences[0]->lastKnownPresence;  // "online"
$chatPresence->presences[0]->lastSeen;           // null or unix timestamp

Engines

WEBJSWPPNOWEBGOWS

References

Released under the MIT License.