Botões e mais botões
3 min
Botões Legados (WEB)
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://{BACKEND_URL}/api/messages/sendBTN',
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 =>'{
"number": "5511989091838",
"customData": {
"body": "Aqui vem o Body",
"footer": "Rodapé",
"imageURL": "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png",
"title": "Título",
"caption": "Caption",
"buttons": "[{\\"buttonId\\":\\"id1\\",\\"type\\":2,\\"buttonText\\":{\\"displayText\\":\\"Botao 1\\"},\\"nativeFlowInfo\\":{\\"name\\":\\"quick_reply\\",\\"paramsJson\\":\\"{\\\\\\"display_text\\\\\\":\\\\\\"Botao 1\\\\\\",\\\\\\"id\\\\\\":\\\\\\"id1\\\\\\",\\\\\\"disabled\\\\\\":false}\\"}},{\\"buttonId\\":\\"id2\\",\\"buttonText\\":{\\"displayText\\":\\"Botao 2\\"},\\"type\\":1},{\\"buttonId\\":\\"id3\\",\\"buttonText\\":{\\"displayText\\":\\"Botao 3\\"},\\"type\\":1}]"
}
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Authorization: Bearer seutokenaqui' //Token cadastrado na conexão
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Botões Quick Reply (Todos os Dispositivos)
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://{BACKEND_URL}/api/messages/sendBTN2',
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 =>'{
"number": "5511989091838",
"customData": {
"body": "Aqui vem o Body",
"name": "quick_reply",
"params": "{\\"display_text\\":\\"LEGAL\\",\\"id\\":\\"6deb1c2f-7863-45eb-8b11-17a8f8131288\\",\\"disabled\\":false}",
"nameb": "quick_reply",
"paramsb": "{\\"display_text\\":\\"NÃO GOSTEI\\",\\"id\\":\\"6deb1c2f-7863-45eb-8b11-17a8f8131288\\",\\"disabled\\":false}"
}
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Authorization: Bearer seutokenaqui'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;