Envia uma enquete com opções de resposta para votação.
Endpoint
Seção intitulada “Endpoint”POST /chat/send/pollParâmetros
Seção intitulada “Parâmetros”| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
to | string | Sim | JID do destinatário |
question | string | Sim | Pergunta da enquete |
options | string[] | Sim | Lista de opções (mín 2, máx 12) |
maxAnswers | number | Não | Máximo de respostas por pessoa (padrão: 1) |
Request
Seção intitulada “Request”curl -X POST https://endpoint.wi.api.br/chat/send/poll \ -H "x-api-key: $WIAPI_KEY" \ -H "x-instance: session_01" \ -H "Content-Type: application/json" \ -d '{ "to": "120363041524927604@g.us", "question": "Melhor horário para a reunião?", "options": ["09:00", "14:00", "16:00"], "maxAnswers": 1 }'const response = await fetch("https://endpoint.wi.api.br/chat/send/poll", { method: "POST", headers: { "x-api-key": process.env.WIAPI_KEY, "x-instance": "session_01", "Content-Type": "application/json", }, body: JSON.stringify({ to: "120363041524927604@g.us", question: "Melhor horário para a reunião?", options: ["09:00", "14:00", "16:00"], maxAnswers: 1, }),});
const data = await response.json();import requests
response = requests.post( "https://endpoint.wi.api.br/chat/send/poll", headers={ "x-api-key": WIAPI_KEY, "x-instance": "session_01", }, json={ "to": "120363041524927604@g.us", "question": "Melhor horário para a reunião?", "options": ["09:00", "14:00", "16:00"], "maxAnswers": 1, },)
data = response.json()Response
Seção intitulada “Response”{ "messageId": "3EB0D8E9F0A1B2C30E4F26", "messageid": "3EB0D8E9F0A1B2C30E4F26"}