API - SISTEMA | BAILEYS | OFIC...
Mensagem HUB (Texto)
1min
PHP
1<?php
2
3$curl = curl_init();
4
5curl_setopt_array($curl, array(
6 CURLOPT_URL => 'https://{BACKEND_URL}/api/messages/sendOfficialData',
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"text": "Mensagem Desejada"
17}',
18 CURLOPT_HTTPHEADER => array(
19 'Content-Type: application/json',
20 'Authorization: Bearer tokenmeu'
21 ),
22));
23
24$response = curl_exec($curl);
25
26curl_close($curl);
27echo $response;
28
JSON
1{
2 "response": {
3 "from": "9aa5ed74-6d9c-4292-b44e-7f8ee2bfa022",
4 "to": "5511989091838",
5 "contents": "{\"type\":\"text\",\"text\":\"Teste\"}",
6 "id": "ab019db2-4172-4eea-910c-d88fdd64f386",
7 "direction": "OUT"
8 }
9}
Updated 25 Dec 2024

Did this page help you?