Skip to content

Send Poll Vote

Vote on a poll.

Usage

The Message facade's sendPollVote method may be used to submit a vote on a poll. You must provide a MessagePollVoteData DTO containing the chat ID, the poll message ID, and the selected options.

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

$data = new MessagePollVoteData(
    chatId: '[email protected]',
    pollMessageId: '[email protected]_AAAAAAAAAAAAAAAAAAAA',
    votes: ['Awesome!'],
);

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

$data = new MessagePollVoteData(
    chatId: '[email protected]',
    pollMessageId: '[email protected]_AAAAAAAAAAAAAAAAAAAA',
    votes: ['Awesome!', 'Good!'],
);

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

Response

The response returned by the sendPollVote 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, ...]
php
use NjoguAmos\Waha\Facades\Message;
use NjoguAmos\Waha\Dto\MessagePollVoteData;

$data = new MessagePollVoteData(
    chatId: '[email protected]',
    pollMessageId: '[email protected]_AAAAAAAAAAAAAAAAAAAA',
    votes: ['Awesome!'],
);

/** @var \Saloon\Http\Response $response */
$response = Message::sendPollVote(data: $data);
$json = $response->json();

Engines

WEBJSWPPNOWEBGOWS
✔️✔️✔️✔️

➕ = supported, ➖ = not supported

The "Engines" table reflects WAHA API-level engine support (WEBJS, WPP, NOWEB, GOWS) and is independent of any wrapper/feature implementation.

References

Released under the MIT License.