Skip to content

Send Location

Send location (latitude and longitude) to your contacts.

Usage

The Message facade's sendLocation method may be used to send a location (latitude and longitude) to a contact or group.

php
use NjoguAmos\Waha\Facades\Message;
use NjoguAmos\Waha\Dto\MessageLocationData;

$data = new MessageLocationData(
    chatId: '[email protected]',
    latitude: 38.8937255,
    longitude: -77.0969763,
    title: 'Our office',
);

/** @var \Saloon\Http\Response $response */
$response = Message::sendLocation(data: $data);
php
use NjoguAmos\Waha\Facades\Message;
use NjoguAmos\Waha\Dto\MessageLocationData;

$data = new MessageLocationData(
    chatId: '[email protected]',
    latitude: 38.8937255,
    longitude: -77.0969763,
    title: 'Our office',
    replyTo: '[email protected]_AAA',
);

/** @var \Saloon\Http\Response $response */
$response = Message::sendLocation(data: $data);

Response

The response returned by the sendLocation method is an instance of Saloon\Http\Response. You may use the json method to retrieve the response as an array:

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

$response->status(); // 201
$response->json();   // ["id" => "[email protected]_BAE6A33293978B16", "timestamp" => 1629200000, ...]

Engines

WEBJSWPPNOWEBGOWS
✔️✔️✔️✔️

References

Released under the MIT License.