Skip to content

Get LID by Phone Number

Fetch the LID for a given phone number (chat ID).

Usage

You can use the Contact facade to fetch the LID for a given phone number.

php
use NjoguAmos\Waha\Facades\Contact;

/** @var \Saloon\Http\Response $response */
$response = Contact::getLid(phone: '[email protected]');

Response

The response returned by the getLid 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 LidData DTO:

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

$response->status(); // 200
$response->json();   // ["lid" => "123123123@lid", "pn" => "[email protected]"]
php
use NjoguAmos\Waha\Facades\Contact;

/** @var \NjoguAmos\Waha\Dto\LidData $dto */
$dto = Contact::getLid(phone: '[email protected]')->dtoOrFail();

$dto->lid; // "123123123@lid"
$dto->pn;  // "[email protected]"

Engines

WEBJSWPPNOWEBGOWS

References

Released under the MIT License.