Skip to content

Chat Presence Data DTO Reference

The NjoguAmos\Waha\Dto\ChatPresenceData represents presence information for a chat.

php
use NjoguAmos\Waha\Facades\Presence;
use NjoguAmos\Waha\Dto\ChatPresenceData;

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

idstring

The chat ID — either a contact ID ([email protected]) or a group chat ID ([email protected]).

php
$chatPresence->id; // "[email protected]"

presenceslist<PresenceChatData>

List of participant presence information. For a direct chat, there is one participant. For a group, there can be multiple.

php
foreach ($chatPresence->presences as $presence) {
    $presence->participant;        // "[email protected]"
    $presence->lastKnownPresence;  // "online"
    $presence->lastSeen;           // null or unix timestamp
}

References

Released under the MIT License.