API Oficial Template Customizado (Hub)
🧩 Envia uma mensagem template customizado pela API oficial, estando previamente aprovada.
API: Oficial
Verifique aqui os Pré-Requisitos para utilizar APIs
Endpoint
https://{BACKEND_URL}/api/messages/sendOfficialCustom
Método
POST
Autenticação
Bearer {seutokenaqui}
Payload
{
"number": "",
"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"
}
]
}
]
}
➡️ “number”: telefone do destinatário no formato ddi ddd numero (somente números). ➡️ “name”: nome do template. ➡️ “language”: idioma. ➡️ “template”:– type: tipo da variável API Utilize o código em requisições HTTPS com ferramentas como cURL ou bibliotecas de integração.
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://{BACKEND_URL}/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": "",
"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 {seutokenaqui}' //Token cadastrado na conexão
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;