Skip to content

Get Profile

Get your WhatsApp profile information.

Usage

php
use NjoguAmos\Waha\Facades\Profile;

/** @var \Saloon\Http\Response $response */
$response = Profile::get();
php
use NjoguAmos\Waha\Facades\Profile;

/** @var \Saloon\Http\Response $response */
$response = Profile::get(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 ProfileData DTO:

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

$response->status(); // 200
$response->json();   // ["id" => "[email protected]", "name" => "My Name", "picture" => "..."]
php
use NjoguAmos\Waha\Facades\Profile;
use NjoguAmos\Waha\Dto\ProfileData;

/** @var ProfileData $profile */
$profile = Profile::get()->dtoOrFail();

$profile->id;      // "[email protected]"
$profile->name;    // "My Name"
$profile->picture; // "https://pps.whatsapp.net/v/t/123.jpg" or null

Engines

WEBJSWPPNOWEBGOWS

References

Released under the MIT License.