API - SISTEMA | BAILEYS | OFIC...

Template API Oficial

4min
envio de template sem variável \<?php $curl = curl init(); curl setopt array($curl, array( curlopt url => 'https //{backend url}/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" "5511989091838", "name" "vars 001", // nome da template "language" "pt br" }', curlopt httpheader => array( 'content type application/json', 'authorization bearer seutoken' ), )); $response = curl exec($curl); curl close($curl); echo $response; envio de template com variável \<?php $curl = curl init(); curl setopt array($curl, array( curlopt url => 'https //beta api whaticket saas 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" "5511989091838", "name" "vars 001", // nome da template "language" "pt br", "template" \[ { "type" "text", "text" "valor 1" // valor variavel 1 }, { "type" "text", "text" "valor 2" // valor variavel 2 }, { "type" "text", "text" "valor 3" // valor variavel 3 } ] }', curlopt httpheader => array( 'content type application/json', 'authorization bearer seutoken' ), )); $response = curl exec($curl); curl close($curl); echo $response; envio de template customizado \<?php $curl = curl init(); curl setopt array($curl, array( curlopt url => 'https //beta api whaticket saas com/api/messages/sendofficialcustom', 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", "name" "vars 001", "language" "pt br", "template" \[ { "type" "header", "parameters" \[{ "type" "image", "image" { "link" "https //url/wp content/uploads/2024/03/front view woman holding smartphone removebg preview\ png" } } ] }, { "type" "button", "sub type" "quick reply", "index" "0", "parameters" \[{ "type" "payload", "payload" "descadastrar" } ] }, { "type" "button", "sub type" "quick reply", "index" "1", "parameters" \[{ "type" "payload", "payload" "alterar contato" } ] } ] }', curlopt httpheader => array( 'content type application/json', 'authorization bearer seutoken' ), )); $response = curl exec($curl); curl close($curl); echo $response;