Send Poll Vote

Programmatically vote on a WhatsApp poll.

POST
https://api.wawp.net/v2/send/poll/vote?access_token=123456789&chatId=201234567890%40c.us&instance_id=123456789&messageId=ABC123456789&votes=%5B%22Awesome%21%22%5D

Authentication Required

Login to swap the placeholders with your real Instance ID and Access Token.

Log In
Test /v2/send/poll/vote endpoint
POST
POST

No query parameters required

This endpoint doesn't expect data in the URL.

Programmatic Participation: Mastering the Poll Vote Engine

In highly automated environments, bots often need to participate in the decision-making process alongside human users. The /v2/send/poll/vote endpoint provides the capability to cast, change, or rescind votes on existing WhatsApp polls programmatically. This enables complex "Bot-in-the-Loop" scenarios where an AI agent can express its findings, preferences, or status via the native interactive poll UI.


🏗️ The Programmatic Voting Architecture

Dynamic voting via an API requires a precise understanding of the poll's state machine:

  1. Target Attachment: The engine requires a valid messageId of a previously sent poll. This ensures the vote is anchored to the correct interactive context.

  2. Option Indexing: Wawp allows you to vote using either the literal string name of an option (e.g., "Awesome!") or its 0-indexed position within the poll. Our engine automatically resolves these to the internal binary IDs required by the WhatsApp network, preventing "Ghost Vote" errors.

  3. State Overwriting: WhatsApp follows an "Overwrite" model for voting. When you call this endpoint, your new votes array completely replaces your previous selection for that poll. If you send an empty array [], tips: [ { type: 'info', title: 'Mechanism', content: 'Casts a vote on an existing poll message.' }, { type: 'warning', title: 'Validation', content: 'Fails if the poll is closed or the option ID is invalid.' } ], recommendations: [ "Verify the Poll Message ID before attempting to vote.", "Use this for automated testing of poll workflows." ]

    your previous vote is retracted entirely.


🛡️ Strategic Best Practices for Bot Participation

1. Verification Before Voting

To ensure high reliability, your system should verify the poll exists and is still "active."

  • Implementation: Before voting, check your local database or use a listener to confirm the poll hasn't been deleted. Programmatically voting on a non-existent or expired poll will return a Message Not Found error.
  • Timing: Avoid voting immediately (within milliseconds) after a poll is created by another user. Adding a small delay (1–2 seconds) mimics natural processing time and ensures the poll has fully propagated across the WhatsApp WebSocket mesh.

2. Managing Multi-Answer Logic

The votes parameter is an array for a reason.

  • Checkboxes vs. Radio Buttons: If the original poll was created with multipleAnswers: true, your array can contain multiple indices (e.g., [0, 2]). If it was a single-choice poll, provided arrays with more than one element will typically result in only the last item being counted by the WhatsApp client UI.
  • UX Consistency: Ensure your bot's votes align with any previous text-based statements it made to avoid confusing human participants.

3. The Power of Selective Retraction

Programmatic voting allows for "Temporary Consensus."

  • Scenario: Your bot can vote for an option while it's "investigating" a problem, and then retract its vote or switch to a "Success" option once the investigation is complete. This provides a visual progress indicator that is much more subtle and professional than spamming the chat with status messages.

🧩 Advanced Use Cases

Automated Consensus Building

Build a "Moderator Bot" that monitors a group poll. Once a specific option reaches a threshold (e.g., 5 votes), the bot can cast its own vote for that option to "Seal the Deal" and then automatically trigger a coordination message or calendar invite.

Sentiment Re-alignment

In an AI-driven support flow, if a user starts a poll to rate their experience, the bot can programmatically vote for the "Neutral" option initially. As the conversation improves and sentiment analysis scores rise, the bot can update its vote to "Positive," providing the human agent with a visual cue of the AI's current assessment of the interaction.


🛠️ Common Pitfalls and Solutions

  • License Barriers: Ensure your instance is correctly provisioned before integrating programmatic voting into your production workflow.
  • Case Sensitivity: When voting via string names, ensured your strings match the poll options exactly (including case and trailing spaces). A mismatch will cause the vote to be ignored or return an error. Using Indices (integers) is the recommended best practice for high-reliability systems.
  • Race Conditions: If multiple instances of your bot attempt to update a vote on the same poll simultaneously, the last request received by the Wawp proxy will define the final state. Use a centralized queue or locking mechanism in your backend if you have multiple bot clusters interacting with the same chat.

Summary of Capabilities:

  • Programmatically cast, update, or retract votes on native WhatsApp polls.
  • Support for voting by literal option strings or numeric indices.
  • Exclusive for advanced automation and AI integration.
  • Full support for multi-choice (checkbox) and single-choice (radio) poll architectures.
  • Real-time synchronization with the WhatsApp network for instantaneous UI updates on recipient devices.

Request Parameters

Configure the parameters required to interact with this endpoint. All query and body arguments are listed below with their details.

Request Body

Sent as a JSON object
string

Your unique WhatsApp Instance ID

Example:
string

Your API Access Token

Example:
string

Target phone number or group ID

Example:
string

The unique ID of the poll message

Example:
array

Array of selected option names or indices

Example:

Request Samples

Use these ready-to-go code snippets to integrate our API into your project quickly and efficiently. Choose your preferred language and library.

1const baseUrl = "https://api.wawp.net";
2const endpoint = "/v2/send/poll/vote";
3const params = new URLSearchParams({
4 "instance_id": "123456789",
5 "access_token": "123456789"
6}).toString();
7const body = {
8 "chatId": "201234567890@c.us",
9 "messageId": "ABC123456789",
10 "votes": [
11 "Awesome!"
12 ]
13};
14
15fetch(`${baseUrl}${endpoint}${params ? '?' + params : ''}`, {
16 method: "POST",
17 headers: { "Content-Type": "application/json" },
18 body: JSON.stringify(body)
19})
20 .then(async (response) => {
21 if (response.ok) {
22 const data = await response.json();
23 console.log("Success:", data);
24 return data;
25 }
26
27 // Error Handling
28 if (response.status === 400) {
29 console.error("Error 400: Bad Request - Missing Required Parameter(s)");
30 }
31 if (response.status === 400) {
32 console.error("Error 400: Bad Request - Invalid Number (Egypt)");
33 }
34 if (response.status === 400) {
35 console.error("Error 400: Bad Request - Invalid Number (Saudi Arabia)");
36 }
37 if (response.status === 400) {
38 console.error("Error 400: Bad Request - Invalid Number (Unknown)");
39 }
40 if (response.status === 400) {
41 console.error("Error 400: Bad Request (XML Format)");
42 }
43 if (response.status === 400) {
44 console.error("Error 400: Bad Request (Plain Text)");
45 }
46 if (response.status === 401) {
47 console.error("Error 401: Unauthorized - Invalid or Missing Access Token");
48 }
49 if (response.status === 401) {
50 console.error("Error 401: Unauthorized (XML Format)");
51 }
52 if (response.status === 404) {
53 console.error("Error 404: Not Found - Session Does Not Exist");
54 }
55 if (response.status === 404) {
56 console.error("Error 404: Not Found (XML Format)");
57 }
58 if (response.status === 429) {
59 console.error("Error 429: Too Many Requests - Rate Limit Exceeded");
60 }
61 if (response.status === 500) {
62 console.error("Error 500: Internal Server Error - Unexpected Failure");
63 }
64 if (response.status === 500) {
65 console.error("Error 500: Internal Server Error (HTML)");
66 }
67 if (response.status === 502) {
68 console.error("Error 502: Bad Gateway - Connection Failed to Upstream");
69 }
70 if (response.status === 502) {
71 console.error("Error 502: Bad Gateway (XML Format)");
72 }
73
74 const errorText = await response.text();
75 console.error(`Error ${response.status}: ${errorText}`);
76 })
77 .catch((error) => console.error("Network Error:", error));
Interactive Samples
Ln 77, Col 1javascript

Expected Responses

Explore all possible responses and outcomes from the server. We have documented each status code with data examples to make success and error handling easier.

Message Sent Successfully
Type:
application/json
object *
string *
object *
number *
boolean *
string *
string *
number *
string *
string *
string *
boolean *
number *
boolean *
boolean *
boolean *
boolean *
boolean *
array *
array *
array *
boolean *
array *

Example

{
"_data": {
  "id": {
    "fromMe": true,
    "remote": "000000000000@c.us",
    "id": "MSG_ID_123456",
    "_serialized": "true_000000000000@c.us_MSG_ID_123456"
    },
  "viewed": false,
  "body": "BASE64_IMAGE_DATA",
  "type": "image",
  "t": 1759108866,
  "from": {
    "server": "c.us",
    "user": "111111111111",
    "_serialized": "111111111111@c.us"
    },
  "to": {
    "server": "c.us",
    "user": "000000000000",
    "_serialized": "000000000000@c.us"
    },
  "ack": 0,
  "isNewMsg": true,
  "star": false,
  "kicNotified": false,
  "caption": "Here's your requested image.",
  "deprecatedMms3Url": "https://example.com/media-url",
  "directPath": "/media/direct/path/example",
  "mimetype": "image/jpeg",
  "filehash": "FILE_HASH_PLACEHOLDER",
  "encFilehash": "ENC_FILE_HASH_PLACEHOLDER",
  "size": 192487,
  "mediaKey": "MEDIA_KEY_PLACEHOLDER",
  "mediaKeyTimestamp": 1759108865,
  "streamable": false,
  "mediaHandle": null,
  "isFromTemplate": false,
  "pollInvalidated": false,
  "isSentCagPollCreation": false,
  "latestEditMsgKey": null,
  "latestEditSenderTimestampMs": null,
  "mentionedJidList": {
    },
  "groupMentions": {
    },
  "isEventCanceled": false,
  "eventInvalidated": false,
  "isVcardOverMmsDocument": false,
  "isForwarded": false,
  "isQuestion": false,
  "questionReplyQuotedMessage": null,
  "questionResponsesCount": 0,
  "readQuestionResponsesCount": 0,
  "labels": {
    },
  "hasReaction": false,
  "disappearingModeInitiator": "chat",
  "disappearingModeTrigger": "chat_settings",
  "productHeaderImageRejected": false,
  "lastPlaybackProgress": 0,
  "isDynamicReplyButtonsMsg": false,
  "isCarouselCard": false,
  "parentMsgId": null,
  "callSilenceReason": null,
  "isVideoCall": false,
  "callDuration": null,
  "callCreator": null,
  "callParticipants": null,
  "isCallLink": null,
  "callLinkToken": null,
  "isMdHistoryMsg": false,
  "stickerSentTs": 0,
  "lastUpdateFromServerTs": 0,
  "invokedBotWid": null,
  "bizBotType": null,
  "botResponseTargetId": null,
  "botPluginType": null,
  "botPluginReferenceIndex": null,
  "botPluginSearchProvider": null,
  "botPluginSearchUrl": null,
  "botPluginSearchQuery": null,
  "botPluginMaybeParent": false,
  "botReelPluginThumbnailCdnUrl": null,
  "botMessageDisclaimerText": null,
  "botMsgBodyType": null,
  "requiresDirectConnection": false,
  "bizContentPlaceholderType": null,
  "hostedBizEncStateMismatch": false,
  "senderOrRecipientAccountTypeHosted": false,
  "placeholderCreatedWhenAccountIsHosted": false,
  "galaxyFlowDisabled": false,
  "links": {
    }
  },
"mediaKey": "MEDIA_KEY_PLACEHOLDER",
"id": {
  "fromMe": true,
  "remote": "000000000000@c.us",
  "id": "MSG_ID_123456",
  "_serialized": "true_000000000000@c.us_MSG_ID_123456"
  },
"ack": 0,
"hasMedia": true,
"body": "Here's your requested image.",
"type": "image",
"timestamp": 1759108866,
"from": "111111111111@c.us",
"to": "000000000000@c.us",
"deviceType": "android",
"isForwarded": false,
"forwardingScore": 0,
"isStatus": false,
"isStarred": false,
"fromMe": true,
"hasQuotedMsg": false,
"hasReaction": false,
"vCards": {
  },
"mentionedIds": {
  },
"groupMentions": {
  },
"isGif": false,
"links": {
  }
}
Bad Request - Missing Required Parameter(s)
Unauthorized - Invalid or Missing Access Token
Not Found - Session Does Not Exist
Too Many Requests - Rate Limit Exceeded
Internal Server Error - Unexpected Failure
Bad Gateway - Connection Failed to Upstream
Previous TopicSend Poll
Next TopicSend Contact Vcard

Command Palette

Search for a command to run...