API - SISTEMA | BAILEYS | OFIC...
Botões e mais botões
3min
PHP
1<?php
2
3$curl = curl_init();
4
5curl_setopt_array($curl, array(
6 CURLOPT_URL => 'https://{BACKEND_URL}/api/messages/sendBTN',
7 CURLOPT_RETURNTRANSFER => true,
8 CURLOPT_ENCODING => '',
9 CURLOPT_MAXREDIRS => 10,
10 CURLOPT_TIMEOUT => 0,
11 CURLOPT_FOLLOWLOCATION => true,
12 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
13 CURLOPT_CUSTOMREQUEST => 'POST',
14 CURLOPT_POSTFIELDS =>'{
15 "number": "5511989091838",
16 "customData": {
17 "body": "Aqui vem o Body",
18 "footer": "Rodapé",
19 "imageURL": "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png",
20 "title": "Título",
21 "caption": "Caption",
22 "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}]"
23 }
24 }',
25 CURLOPT_HTTPHEADER => array(
26 'Content-Type: application/json',
27 'Authorization: Bearer seutokenaqui' //Token cadastrado na conexão
28 ),
29));
30
31$response = curl_exec($curl);
32
33curl_close($curl);
34echo $response;
35
PHP
1<?php
2
3$curl = curl_init();
4
5curl_setopt_array($curl, array(
6 CURLOPT_URL => 'https://{BACKEND_URL}/api/messages/sendBTN2',
7 CURLOPT_RETURNTRANSFER => true,
8 CURLOPT_ENCODING => '',
9 CURLOPT_MAXREDIRS => 10,
10 CURLOPT_TIMEOUT => 0,
11 CURLOPT_FOLLOWLOCATION => true,
12 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
13 CURLOPT_CUSTOMREQUEST => 'POST',
14 CURLOPT_POSTFIELDS =>'{
15"number": "5511989091838",
16"customData": {
17 "body": "Aqui vem o Body",
18 "name": "quick_reply",
19 "params": "{\\"display_text\\":\\"LEGAL\\",\\"id\\":\\"6deb1c2f-7863-45eb-8b11-17a8f8131288\\",\\"disabled\\":false}",
20 "nameb": "quick_reply",
21 "paramsb": "{\\"display_text\\":\\"NÃO GOSTEI\\",\\"id\\":\\"6deb1c2f-7863-45eb-8b11-17a8f8131288\\",\\"disabled\\":false}"
22 }
23}',
24 CURLOPT_HTTPHEADER => array(
25 'Content-Type: application/json',
26 'Authorization: Bearer seutokenaqui'
27 ),
28));
29
30$response = curl_exec($curl);
31
32curl_close($curl);
33echo $response;
34
Updated 08 Sep 2024
Did this page help you?