Inicio API Tutorial

Plantilla API oficial

Posted on 2024-05-17 Updated on 2024-05-17

Plantilla API oficial


PHP

<?php

$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.waclis.com/api/messages/sendOfficial',
  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": "5491144332211",
    "name": "vars_001", // nombre del template
    "language": "pt_ES"
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: token'
  ),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;

Enviar plantilla con variable


PHP

<?php

$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.waclis.com/api/messages/sendOfficial',
  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": "5491144332211",
    "name": "vars_001", // nombre del template
    "language": "pt_ES",
    "template": [
        {
            "type": "text",
            "text": "valor 1" // valor variable 1
        },
        {
            "type": "text",
            "text": "Valor 2" // valor variable 2
        },
        {
            "type": "text",
            "text": "Valor 3" // valor variable 3
        }
    ]
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: token'
  ),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;



¿Fue útil este tutorial?

[ 0 de 1 encontro útil ]