Skip to content

Send Buttons Reply

If you’re using Official Business API to send buttons and wanna “click” on the buttons (for testing or other purposes) you can do it using the API

Usage

The Message facade's sendButtonsReply method may be used to send a reply to a button message.

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

$data = new MessageButtonReplyData(
    chatId: '[email protected]',
    selectedDisplayText: 'Yes',
    selectedButtonID: 'btn-yes',
    replyTo: '[email protected]_BAE6A33293978B16',
);

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

Response

The response returned by the sendButtonsReply 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.