Listar templates do canal
curl --request GET \
--url https://api.olie.ai/api/management/channels/{channel}/templates \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.olie.ai/api/management/channels/{channel}/templates"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.olie.ai/api/management/channels/{channel}/templates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.olie.ai/api/management/channels/{channel}/templates",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.olie.ai/api/management/channels/{channel}/templates"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.olie.ai/api/management/channels/{channel}/templates")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.olie.ai/api/management/channels/{channel}/templates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"response": true,
"templates": [
{
"name": "pedido_enviado",
"language": "pt_BR",
"category": "UTILITY",
"status": "APPROVED",
"components": [
{
"type": "HEADER",
"format": "TEXT",
"text": "Pedido {{1}}"
},
{
"type": "BODY",
"text": "Olá, {{1}}! Seu pedido {{2}} foi enviado e chega até {{3}}."
},
{
"type": "FOOTER",
"text": "Equipe Exemplo"
},
{
"type": "BUTTONS",
"buttons": [
{
"type": "QUICK_REPLY",
"text": "Recebi"
}
]
}
],
"parameter_format": "POSITIONAL",
"header_text": "Pedido {{1}}",
"body_text": "Olá, {{1}}! Seu pedido {{2}} foi enviado e chega até {{3}}.",
"footer_text": "Equipe Exemplo",
"parameters": {
"header": 1,
"body": 3,
"header_names": [
"1"
],
"body_names": [
"1",
"2",
"3"
],
"buttons": []
}
},
{
"name": "inscricao_confirmada",
"language": "pt_BR",
"category": "UTILITY",
"status": "APPROVED",
"components": [
{
"type": "HEADER",
"format": "TEXT",
"text": "Inscrição confirmada"
},
{
"type": "BODY",
"text": "Olá, {{nome}}! Sua inscrição em {{evento}} está confirmada para {{data}}."
},
{
"type": "FOOTER",
"text": "Equipe Exemplo"
},
{
"type": "BUTTONS",
"buttons": [
{
"type": "URL",
"text": "Ver evento",
"url": "https://exemplo.com/evento/{{1}}"
},
{
"type": "QUICK_REPLY",
"text": "Recebi"
}
]
}
],
"parameter_format": "NAMED",
"header_text": "Inscrição confirmada",
"body_text": "Olá, {{nome}}! Sua inscrição em {{evento}} está confirmada para {{data}}.",
"footer_text": "Equipe Exemplo",
"parameters": {
"header": 0,
"body": 3,
"header_names": [],
"body_names": [
"nome",
"evento",
"data"
],
"buttons": [
{
"index": 0,
"text": "Ver evento",
"url": "https://exemplo.com/evento/{{1}}"
}
]
}
}
]
}{
"response": false,
"message": "channel_model_not_found",
"error": "No query results for model [App\\Models\\Channel] 9b2a1c3e-4d5f-6789-abcd-ef0123456789"
}{
"response": false,
"message": "channel_capability_not_supported",
"error": "This channel does not support templates.",
"capability": "templates"
}{
"response": false,
"message": "channel_templates_unavailable",
"error": "The provider did not list the templates."
}channels
Listar templates do canal
Lista os templates (modelos de mensagem) aprovados que o canal pode enviar, consultados na hora no provedor. Só o WhatsApp Cloud com conta de negócio (waba_id) tem templates — o canal informa isso em capabilities.templates; veja Integrações. O campo parameters diz o que o envio precisa: os marcadores de cabeçalho e corpo (posicionais {{1}} ou nomeados {{nome}}) e os botões de URL dinâmica. Ficam de fora templates com cabeçalho de mídia ou localização e com botão que pede outro tipo de parâmetro (copiar código, senha, flow).
GET
/
api
/
management
/
channels
/
{channel}
/
templates
Listar templates do canal
curl --request GET \
--url https://api.olie.ai/api/management/channels/{channel}/templates \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.olie.ai/api/management/channels/{channel}/templates"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.olie.ai/api/management/channels/{channel}/templates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.olie.ai/api/management/channels/{channel}/templates",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.olie.ai/api/management/channels/{channel}/templates"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.olie.ai/api/management/channels/{channel}/templates")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.olie.ai/api/management/channels/{channel}/templates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"response": true,
"templates": [
{
"name": "pedido_enviado",
"language": "pt_BR",
"category": "UTILITY",
"status": "APPROVED",
"components": [
{
"type": "HEADER",
"format": "TEXT",
"text": "Pedido {{1}}"
},
{
"type": "BODY",
"text": "Olá, {{1}}! Seu pedido {{2}} foi enviado e chega até {{3}}."
},
{
"type": "FOOTER",
"text": "Equipe Exemplo"
},
{
"type": "BUTTONS",
"buttons": [
{
"type": "QUICK_REPLY",
"text": "Recebi"
}
]
}
],
"parameter_format": "POSITIONAL",
"header_text": "Pedido {{1}}",
"body_text": "Olá, {{1}}! Seu pedido {{2}} foi enviado e chega até {{3}}.",
"footer_text": "Equipe Exemplo",
"parameters": {
"header": 1,
"body": 3,
"header_names": [
"1"
],
"body_names": [
"1",
"2",
"3"
],
"buttons": []
}
},
{
"name": "inscricao_confirmada",
"language": "pt_BR",
"category": "UTILITY",
"status": "APPROVED",
"components": [
{
"type": "HEADER",
"format": "TEXT",
"text": "Inscrição confirmada"
},
{
"type": "BODY",
"text": "Olá, {{nome}}! Sua inscrição em {{evento}} está confirmada para {{data}}."
},
{
"type": "FOOTER",
"text": "Equipe Exemplo"
},
{
"type": "BUTTONS",
"buttons": [
{
"type": "URL",
"text": "Ver evento",
"url": "https://exemplo.com/evento/{{1}}"
},
{
"type": "QUICK_REPLY",
"text": "Recebi"
}
]
}
],
"parameter_format": "NAMED",
"header_text": "Inscrição confirmada",
"body_text": "Olá, {{nome}}! Sua inscrição em {{evento}} está confirmada para {{data}}.",
"footer_text": "Equipe Exemplo",
"parameters": {
"header": 0,
"body": 3,
"header_names": [],
"body_names": [
"nome",
"evento",
"data"
],
"buttons": [
{
"index": 0,
"text": "Ver evento",
"url": "https://exemplo.com/evento/{{1}}"
}
]
}
}
]
}{
"response": false,
"message": "channel_model_not_found",
"error": "No query results for model [App\\Models\\Channel] 9b2a1c3e-4d5f-6789-abcd-ef0123456789"
}{
"response": false,
"message": "channel_capability_not_supported",
"error": "This channel does not support templates.",
"capability": "templates"
}{
"response": false,
"message": "channel_templates_unavailable",
"error": "The provider did not list the templates."
}Authorizations
Was this page helpful?