Votar em uma enquete
curl --request POST \
--url https://api.wabox.me/instances/{instance_id}/token/{token}/send-poll-vote \
--header 'Content-Type: application/json' \
--data '
{
"phone": "120363012345678901-group",
"poll_message_id": "3EB0A9C6D2F1E4B5A7C8",
"options": [
"14:00"
]
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
phone: '120363012345678901-group',
poll_message_id: '3EB0A9C6D2F1E4B5A7C8',
options: ['14:00']
})
};
fetch('https://api.wabox.me/instances/{instance_id}/token/{token}/send-poll-vote', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.wabox.me/instances/{instance_id}/token/{token}/send-poll-vote"
payload = {
"phone": "120363012345678901-group",
"poll_message_id": "3EB0A9C6D2F1E4B5A7C8",
"options": ["14:00"]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.wabox.me/instances/{instance_id}/token/{token}/send-poll-vote",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'phone' => '120363012345678901-group',
'poll_message_id' => '3EB0A9C6D2F1E4B5A7C8',
'options' => [
'14:00'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.wabox.me/instances/{instance_id}/token/{token}/send-poll-vote"
payload := strings.NewReader("{\n \"phone\": \"120363012345678901-group\",\n \"poll_message_id\": \"3EB0A9C6D2F1E4B5A7C8\",\n \"options\": [\n \"14:00\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"id": "3EB0A9C6D2F1E4B5A7C8",
"message_id": "3EB0A9C6D2F1E4B5A7C8",
"wabox_id": "wbx_01J5Q8ZK3M4N5P6Q7R8S9T0M01",
"status": "queued"
}{
"error": {
"code": "instance_not_found",
"message": "Instance not found or invalid token"
}
}{
"error": {
"code": "subscription_required",
"message": "Trial expired or subscription inactive. Subscribe in the dashboard to keep sending."
}
}{
"error": {
"code": "queue_disabled_while_disconnected",
"message": "Instance is disconnected and enqueueing while disconnected is disabled"
}
}{
"error": {
"code": "queue_full",
"message": "Queue is full (1000 messages waiting)"
}
}Só é possível votar em enquetes que esta instância enviou ou recebeu. options recebe os nomes das opções; um array vazio limpa o voto. Não aceita delay_message/delay_typing. A mensagem entra na fila e é enviada de forma assíncrona; message_id já é o id definitivo no WhatsApp (id é um alias dele) e o resultado chega no webhook delivery.
POST
/
instances
/
{instance_id}
/
token
/
{token}
/
send-poll-vote
Votar em uma enquete
curl --request POST \
--url https://api.wabox.me/instances/{instance_id}/token/{token}/send-poll-vote \
--header 'Content-Type: application/json' \
--data '
{
"phone": "120363012345678901-group",
"poll_message_id": "3EB0A9C6D2F1E4B5A7C8",
"options": [
"14:00"
]
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
phone: '120363012345678901-group',
poll_message_id: '3EB0A9C6D2F1E4B5A7C8',
options: ['14:00']
})
};
fetch('https://api.wabox.me/instances/{instance_id}/token/{token}/send-poll-vote', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.wabox.me/instances/{instance_id}/token/{token}/send-poll-vote"
payload = {
"phone": "120363012345678901-group",
"poll_message_id": "3EB0A9C6D2F1E4B5A7C8",
"options": ["14:00"]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.wabox.me/instances/{instance_id}/token/{token}/send-poll-vote",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'phone' => '120363012345678901-group',
'poll_message_id' => '3EB0A9C6D2F1E4B5A7C8',
'options' => [
'14:00'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.wabox.me/instances/{instance_id}/token/{token}/send-poll-vote"
payload := strings.NewReader("{\n \"phone\": \"120363012345678901-group\",\n \"poll_message_id\": \"3EB0A9C6D2F1E4B5A7C8\",\n \"options\": [\n \"14:00\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"id": "3EB0A9C6D2F1E4B5A7C8",
"message_id": "3EB0A9C6D2F1E4B5A7C8",
"wabox_id": "wbx_01J5Q8ZK3M4N5P6Q7R8S9T0M01",
"status": "queued"
}{
"error": {
"code": "instance_not_found",
"message": "Instance not found or invalid token"
}
}{
"error": {
"code": "subscription_required",
"message": "Trial expired or subscription inactive. Subscribe in the dashboard to keep sending."
}
}{
"error": {
"code": "queue_disabled_while_disconnected",
"message": "Instance is disconnected and enqueueing while disconnected is disabled"
}
}{
"error": {
"code": "queue_full",
"message": "Queue is full (1000 messages waiting)"
}
}Path Parameters
Id da instância (dashboard › instância › Credenciais).
Token da instância. Trate como senha.
Body
application/json
Chat de destino: número só dígitos com DDI e DDD (5511988887777), grupo (<id>-group), canal (<id>@newsletter), LID (<id>@lid) ou status@broadcast.
Minimum string length:
1Pattern:
^(\d{5,20}|\d+@lid|\d+(-\d+)?-group|\d+@g\.us|\d+@newsletter|\d+@broadcast|status@broadcast)$Minimum string length:
1Maximum array length:
12Required string length:
1 - 100Se a mensagem referenciada foi enviada por esta instância. Padrão: o que o engine registrou, senão false.
Grupos: número do participante que enviou a mensagem referenciada.
Minimum string length:
1Pattern:
^(\d{5,20}|\d+@lid|\d+(-\d+)?-group|\d+@g\.us|\d+@newsletter|\d+@broadcast|status@broadcast)$