API - SISTEMA | BAILEYS | OFIC...
Template API Oficial
4min
PHP
1<?php
2
3$curl = curl_init();
4
5curl_setopt_array($curl, array(
6 CURLOPT_URL => 'https://{BACKEND_URL}/api/messages/sendOfficial',
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 "name": "vars_001", // nome da template
17 "language": "pt_BR"
18}',
19 CURLOPT_HTTPHEADER => array(
20 'Content-Type: application/json',
21 'Authorization: Bearer seutoken'
22 ),
23));
24
25$response = curl_exec($curl);
26
27curl_close($curl);
28echo $response;
29
PHP
1<?php
2
3$curl = curl_init();
4
5curl_setopt_array($curl, array(
6 CURLOPT_URL => 'https://beta-api.whaticket-saas.com/api/messages/sendOfficial',
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 "name": "vars_001", // nome da template
17 "language": "pt_BR",
18 "template": [
19 {
20 "type": "text",
21 "text": "valor 1" // valor variavel 1
22 },
23 {
24 "type": "text",
25 "text": "Valor 2" // valor variavel 2
26 },
27 {
28 "type": "text",
29 "text": "Valor 3" // valor variavel 3
30 }
31 ]
32}',
33 CURLOPT_HTTPHEADER => array(
34 'Content-Type: application/json',
35 'Authorization: Bearer seutoken'
36 ),
37));
38
39$response = curl_exec($curl);
40
41curl_close($curl);
42echo $response;
43
PHP
1<?php
2
3$curl = curl_init();
4
5curl_setopt_array($curl, array(
6 CURLOPT_URL => 'https://beta-api.whaticket-saas.com/api/messages/sendOfficialCustom',
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 "name": "vars_001",
17 "language": "pt_BR",
18 "template": [
19 {
20 "type": "header",
21 "parameters": [{
22 "type": "image",
23 "image": {
24 "link": "https://URL/wp-content/uploads/2024/03/front-view-woman-holding-smartphone-removebg-preview.png"
25 }
26 }
27 ]
28 }, {
29 "type": "button",
30 "sub_type": "quick_reply",
31 "index": "0",
32 "parameters": [{
33 "type": "payload",
34 "payload": "Descadastrar"
35 }
36 ]
37 }, {
38 "type": "button",
39 "sub_type": "quick_reply",
40 "index": "1",
41 "parameters": [{
42 "type": "payload",
43 "payload": "Alterar Contato"
44 }
45 ]
46 }
47 ]
48}',
49 CURLOPT_HTTPHEADER => array(
50 'Content-Type: application/json',
51 'Authorization: Bearer seutoken'
52 ),
53));
54
55$response = curl_exec($curl);
56
57curl_close($curl);
58echo $response;
59
Updated 26 Jun 2024
![Doc contributor](https://s3.amazonaws.com/archbee-animals/koala.png)
Did this page help you?