POST /send-buttons
Envia uma mensagem WhatsApp com até 3 botões de resposta rápida (reply buttons). O cliente clica em um botão e a resposta volta via webhook do WhatsApp como mensagem normal.
| Campo | Valor |
|---|---|
| URL | https://api.wevi.chat/functions/v1/send-buttons |
| Método | POST |
| Auth | Authorization: Bearer wevi_... (API key) |
| Content-Type | application/json |
| Rate limit | 60 req/min por API key |
| Plano necessário | Pro ou Ultra |
Body
| Campo | Tipo | Obrigatório | Descrição |
|---|---|---|---|
connection_id |
string (uuid) | sim | ID da conexão WhatsApp da sua org. |
to |
string | sim | Telefone destino (com ou sem +55). |
body |
string | sim | Texto principal. Max 1024 caracteres. |
footer |
string | não | Rodapé curto. Max 60. |
header |
object | não | { type: "text"|"image"|"video"|"document", text?, image_url?, video_url?, document_url?, filename? }. |
buttons |
array | sim | 1 a 3 botões. Cada um: { id?: string, title: string }. title max 20 chars. |
contact_id |
string (uuid) | não | Vincula ao contato. |
idempotency_key |
string | não | Evita duplicação em retries. |
Exemplo
curl -X POST https://api.wevi.chat/functions/v1/send-buttons \
-H "Authorization: Bearer wevi_abc..." \
-H "Content-Type: application/json" \
-d '{
"connection_id": "conn-uuid",
"to": "+5511999999999",
"body": "Como você quer ser contatado?",
"footer": "Resposta automática",
"buttons": [
{ "id": "wa", "title": "WhatsApp" },
{ "id": "phone", "title": "Ligação" },
{ "id": "email", "title": "Email" }
]
}'
await fetch("https://api.wevi.chat/functions/v1/send-buttons", {
method: "POST",
headers: { "Authorization": "Bearer wevi_abc...", "Content-Type": "application/json" },
body: JSON.stringify({
connection_id: "conn-uuid",
to: "+5511999999999",
body: "Como você quer ser contatado?",
buttons: [
{ id: "wa", title: "WhatsApp" },
{ id: "phone", title: "Ligação" },
{ id: "email", title: "Email" },
],
}),
});
Resposta
Sucesso (200)
{ "id": "envio-uuid", "wamid": "wamid.HBgN...", "status": "sent" }
Erros
| Status | error |
|---|---|
| 400 | connection_id is required, to is required, body is required |
| 400 | 'buttons' must have 1 to 3 items, button.title max 20 chars |
| 401 | Invalid API key |
| 402 | plan_limit_exceeded |
| 404 | Connection not found |
| 429 | Too many requests |
Como o cliente responde
Quando o cliente clica num botão, o WhatsApp envia uma mensagem com type: "interactive" e interactive.button_reply. A Wevi persiste isso no histórico da conversa como uma mensagem normal do contato, com metadata.kind = "interaction_reply" (e o id do botão clicado em metadata.payload.id). Pra integrações que escutam mensagens da conversa, o title do botão chega como content.
Próximo
/send-list