<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://{BACKEND_URL}/api/messages/whatsmeow/sendButtonsPRO',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"openTicket": 0,
"body" : [
{
"phone": "554799444499",
"title": "Escolha uma opção",
"body": "Clique em uma das opções abaixo:",
"footer": "Teste de Quick Reply",
"buttons": [
{
"type": "quick_reply",
"text": "Sim",
"id": "opcao_sim"
}
]
}
]
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Authorization: Bearer seutokenaqui' //Token cadastrado na conexão
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Exemplos de Payload:
1. Botão Quick Reply
{
"phone": "554799444499",
"title": "Escolha uma opção",
"body": "Clique em uma das opções abaixo:",
"footer": "Teste de Quick Reply",
"buttons": [
{
"type": "quick_reply",
"text": "Sim",
"id": "opcao_sim"
}
]
}2. Botão URL
{
"phone": "554799444499",
"title": "Veja nosso site",
"body": "Clique para acessar:",
"footer": "Link oficial",
"buttons": [
{
"type": "url",
"text": "Acesse o site",
"url": "https://www.google.com"
}
]
}3. Botão Call
{
"phone": "554799444499",
"title": "Precisa de atendimento?",
"body": "Clique para ligar:",
"footer": "Central de Atendimento",
"buttons": [
{
"type": "call",
"text": "Ligar agora",
"phoneNumber": "+554799444499"
}
]
}
4. Botão Copy
{
"phone": "554799444499",
"title": "Seu cupom exclusivo",
"body": "Use o cupom abaixo:",
"footer": "Oferta válida até hoje",
"buttons": [
{
"type": "copy",
"text": "Copiar CUPOM",
"code": "MEU-CUPOM-123"
}
]
}5. Botão Review & Pay (Pix com instruções customizadas)
{
"phone": "554799444499",
"title": "Cobrança personalizada",
"body": "Clique para pagar após revisar os detalhes:",
"footer": "Pagamento inteligente",
"buttons": [
{
"type": "review_and_pay",
"text": "Revisar e pagar",
"pixKey": "whamax@pix.com.br",
"pixType": "EMAIL",
"instructions": "Confira os detalhes do pedido antes de pagar."
}
]
}6. Pagar com PIX
{
"phone": "554799444499",
"title": "Pagamento com PIX",
"body": "Clique no botão para pagar com PIX!",
"footer": "Pedido #123",
"buttons": [
{
"type": "pix",
"text": "Pagar com PIX",
"pixKey": "123e4567-e12b-12d1-a456-426614174000",
"pixType": "EVP"
}
]
}7. Múltiplos botões no mesmo payload
{
"phone": "554799444499",
"title": "O que deseja fazer?",
"body": "Escolha uma opção:",
"footer": "Multi-botão",
"buttons": [
{
"type": "url",
"text": "Site",
"url": "https://openai.com"
},
{
"type": "call",
"text": "Ligar",
"phoneNumber": "+554799444499"
},
{
"type": "copy",
"text": "Copiar PIX",
"code": "123e4567-e12b-12d1-a456-426614174000"
}
]
}