Skip to content

Send Text

Use the API to send text messages to the chat.

Usage

The Message facade's sendText method may be used to send text messages to a chat.

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

$data = new MessageTextData(
    chatId: '[email protected]',
    text: 'Hello World!',
);

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

$data = new MessageTextData(
    chatId: '[email protected]',
    text: 'This is a reply',
    reply_to: '[email protected]_AAA',
);

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

$data = new MessageTextData(
    chatId: '[email protected]',
    text: 'Hello @123456789',
    mentions: ['[email protected]'],
);

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

$data = new MessageTextData(
    chatId: '[email protected]',
    text: 'Check this out: https://waha.devlike.pro/',
    linkPreview: true,
    linkPreviewHighQuality: true,
);

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

Send Typing Status

Enabling send_typing_status in your config/waha.php reduces the chances of being blocked by WhatsApp but may add 3–30 seconds of blocking latency to every sendText() call.

The package sends 'online', 'typing', and 'paused' presence updates; if any update fails (e.g., due to engine limitations) the error is logged and message sending continues.

Response

The response returned by the sendText 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
✔️✔️✔️✔️

Checks indicate WAHA API engine support, independent of Laravel wrapper implementation status.

References

Released under the MIT License.