Crear Plantilla
curl --request POST \
--url https://api.jelou.ai/v1/bots/{botId}/templates \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"language": "<string>",
"elementName": "<string>",
"template": "<string>",
"isVisible": true,
"params": [
{
"param": "<string>",
"label": "<string>",
"example": "<string>"
}
],
"paramsNumber": 123,
"displayName": "<string>",
"mediaUrl": "<string>",
"buttons": [
{
"text": "<string>",
"url": "<string>",
"phone_number": "<string>",
"example": "<string>"
}
],
"header": "<string>",
"exampleHeader": "<string>",
"headerParams": [
{}
],
"example": "<string>",
"extraSettings": {
"addSecurityRecommendation": true,
"codeExpirationMinutes": 45,
"allowChangeCategory": true
}
}
'import requests
url = "https://api.jelou.ai/v1/bots/{botId}/templates"
payload = {
"language": "<string>",
"elementName": "<string>",
"template": "<string>",
"isVisible": True,
"params": [
{
"param": "<string>",
"label": "<string>",
"example": "<string>"
}
],
"paramsNumber": 123,
"displayName": "<string>",
"mediaUrl": "<string>",
"buttons": [
{
"text": "<string>",
"url": "<string>",
"phone_number": "<string>",
"example": "<string>"
}
],
"header": "<string>",
"exampleHeader": "<string>",
"headerParams": [{}],
"example": "<string>",
"extraSettings": {
"addSecurityRecommendation": True,
"codeExpirationMinutes": 45,
"allowChangeCategory": True
}
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
language: '<string>',
elementName: '<string>',
template: '<string>',
isVisible: true,
params: [{param: '<string>', label: '<string>', example: '<string>'}],
paramsNumber: 123,
displayName: '<string>',
mediaUrl: '<string>',
buttons: [
{
text: '<string>',
url: '<string>',
phone_number: '<string>',
example: '<string>'
}
],
header: '<string>',
exampleHeader: '<string>',
headerParams: [{}],
example: '<string>',
extraSettings: {
addSecurityRecommendation: true,
codeExpirationMinutes: 45,
allowChangeCategory: true
}
})
};
fetch('https://api.jelou.ai/v1/bots/{botId}/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.jelou.ai/v1/bots/{botId}/templates",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'language' => '<string>',
'elementName' => '<string>',
'template' => '<string>',
'isVisible' => true,
'params' => [
[
'param' => '<string>',
'label' => '<string>',
'example' => '<string>'
]
],
'paramsNumber' => 123,
'displayName' => '<string>',
'mediaUrl' => '<string>',
'buttons' => [
[
'text' => '<string>',
'url' => '<string>',
'phone_number' => '<string>',
'example' => '<string>'
]
],
'header' => '<string>',
'exampleHeader' => '<string>',
'headerParams' => [
[
]
],
'example' => '<string>',
'extraSettings' => [
'addSecurityRecommendation' => true,
'codeExpirationMinutes' => 45,
'allowChangeCategory' => true
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.jelou.ai/v1/bots/{botId}/templates"
payload := strings.NewReader("{\n \"language\": \"<string>\",\n \"elementName\": \"<string>\",\n \"template\": \"<string>\",\n \"isVisible\": true,\n \"params\": [\n {\n \"param\": \"<string>\",\n \"label\": \"<string>\",\n \"example\": \"<string>\"\n }\n ],\n \"paramsNumber\": 123,\n \"displayName\": \"<string>\",\n \"mediaUrl\": \"<string>\",\n \"buttons\": [\n {\n \"text\": \"<string>\",\n \"url\": \"<string>\",\n \"phone_number\": \"<string>\",\n \"example\": \"<string>\"\n }\n ],\n \"header\": \"<string>\",\n \"exampleHeader\": \"<string>\",\n \"headerParams\": [\n {}\n ],\n \"example\": \"<string>\",\n \"extraSettings\": {\n \"addSecurityRecommendation\": true,\n \"codeExpirationMinutes\": 45,\n \"allowChangeCategory\": true\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.jelou.ai/v1/bots/{botId}/templates")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"language\": \"<string>\",\n \"elementName\": \"<string>\",\n \"template\": \"<string>\",\n \"isVisible\": true,\n \"params\": [\n {\n \"param\": \"<string>\",\n \"label\": \"<string>\",\n \"example\": \"<string>\"\n }\n ],\n \"paramsNumber\": 123,\n \"displayName\": \"<string>\",\n \"mediaUrl\": \"<string>\",\n \"buttons\": [\n {\n \"text\": \"<string>\",\n \"url\": \"<string>\",\n \"phone_number\": \"<string>\",\n \"example\": \"<string>\"\n }\n ],\n \"header\": \"<string>\",\n \"exampleHeader\": \"<string>\",\n \"headerParams\": [\n {}\n ],\n \"example\": \"<string>\",\n \"extraSettings\": {\n \"addSecurityRecommendation\": true,\n \"codeExpirationMinutes\": 45,\n \"allowChangeCategory\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.jelou.ai/v1/bots/{botId}/templates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"language\": \"<string>\",\n \"elementName\": \"<string>\",\n \"template\": \"<string>\",\n \"isVisible\": true,\n \"params\": [\n {\n \"param\": \"<string>\",\n \"label\": \"<string>\",\n \"example\": \"<string>\"\n }\n ],\n \"paramsNumber\": 123,\n \"displayName\": \"<string>\",\n \"mediaUrl\": \"<string>\",\n \"buttons\": [\n {\n \"text\": \"<string>\",\n \"url\": \"<string>\",\n \"phone_number\": \"<string>\",\n \"example\": \"<string>\"\n }\n ],\n \"header\": \"<string>\",\n \"exampleHeader\": \"<string>\",\n \"headerParams\": [\n {}\n ],\n \"example\": \"<string>\",\n \"extraSettings\": {\n \"addSecurityRecommendation\": true,\n \"codeExpirationMinutes\": 45,\n \"allowChangeCategory\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"message": [
"<string>"
],
"status": "<string>",
"data": {}
}{
"message": "<string>",
"statusMessage": "<string>",
"status": 123,
"error": {
"code": "<string>",
"key": "<string>",
"description": "<string>",
"developerMessages": {},
"clientMessages": {}
},
"validationError": {}
}{
"message": "<string>",
"statusMessage": "<string>",
"status": 123,
"error": {
"code": "<string>",
"key": "<string>",
"description": "<string>",
"developerMessages": {},
"clientMessages": {}
},
"validationError": {}
}{
"message": "<string>",
"statusMessage": "<string>",
"status": 123,
"error": {
"code": "<string>",
"key": "<string>",
"description": "<string>",
"developerMessages": {},
"clientMessages": {}
},
"validationError": {}
}Modelos
Criar Template
Crie um novo template HSM e envie-o ao WhatsApp para aprovação
POST
/
v1
/
bots
/
{botId}
/
templates
Crear Plantilla
curl --request POST \
--url https://api.jelou.ai/v1/bots/{botId}/templates \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"language": "<string>",
"elementName": "<string>",
"template": "<string>",
"isVisible": true,
"params": [
{
"param": "<string>",
"label": "<string>",
"example": "<string>"
}
],
"paramsNumber": 123,
"displayName": "<string>",
"mediaUrl": "<string>",
"buttons": [
{
"text": "<string>",
"url": "<string>",
"phone_number": "<string>",
"example": "<string>"
}
],
"header": "<string>",
"exampleHeader": "<string>",
"headerParams": [
{}
],
"example": "<string>",
"extraSettings": {
"addSecurityRecommendation": true,
"codeExpirationMinutes": 45,
"allowChangeCategory": true
}
}
'import requests
url = "https://api.jelou.ai/v1/bots/{botId}/templates"
payload = {
"language": "<string>",
"elementName": "<string>",
"template": "<string>",
"isVisible": True,
"params": [
{
"param": "<string>",
"label": "<string>",
"example": "<string>"
}
],
"paramsNumber": 123,
"displayName": "<string>",
"mediaUrl": "<string>",
"buttons": [
{
"text": "<string>",
"url": "<string>",
"phone_number": "<string>",
"example": "<string>"
}
],
"header": "<string>",
"exampleHeader": "<string>",
"headerParams": [{}],
"example": "<string>",
"extraSettings": {
"addSecurityRecommendation": True,
"codeExpirationMinutes": 45,
"allowChangeCategory": True
}
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
language: '<string>',
elementName: '<string>',
template: '<string>',
isVisible: true,
params: [{param: '<string>', label: '<string>', example: '<string>'}],
paramsNumber: 123,
displayName: '<string>',
mediaUrl: '<string>',
buttons: [
{
text: '<string>',
url: '<string>',
phone_number: '<string>',
example: '<string>'
}
],
header: '<string>',
exampleHeader: '<string>',
headerParams: [{}],
example: '<string>',
extraSettings: {
addSecurityRecommendation: true,
codeExpirationMinutes: 45,
allowChangeCategory: true
}
})
};
fetch('https://api.jelou.ai/v1/bots/{botId}/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.jelou.ai/v1/bots/{botId}/templates",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'language' => '<string>',
'elementName' => '<string>',
'template' => '<string>',
'isVisible' => true,
'params' => [
[
'param' => '<string>',
'label' => '<string>',
'example' => '<string>'
]
],
'paramsNumber' => 123,
'displayName' => '<string>',
'mediaUrl' => '<string>',
'buttons' => [
[
'text' => '<string>',
'url' => '<string>',
'phone_number' => '<string>',
'example' => '<string>'
]
],
'header' => '<string>',
'exampleHeader' => '<string>',
'headerParams' => [
[
]
],
'example' => '<string>',
'extraSettings' => [
'addSecurityRecommendation' => true,
'codeExpirationMinutes' => 45,
'allowChangeCategory' => true
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.jelou.ai/v1/bots/{botId}/templates"
payload := strings.NewReader("{\n \"language\": \"<string>\",\n \"elementName\": \"<string>\",\n \"template\": \"<string>\",\n \"isVisible\": true,\n \"params\": [\n {\n \"param\": \"<string>\",\n \"label\": \"<string>\",\n \"example\": \"<string>\"\n }\n ],\n \"paramsNumber\": 123,\n \"displayName\": \"<string>\",\n \"mediaUrl\": \"<string>\",\n \"buttons\": [\n {\n \"text\": \"<string>\",\n \"url\": \"<string>\",\n \"phone_number\": \"<string>\",\n \"example\": \"<string>\"\n }\n ],\n \"header\": \"<string>\",\n \"exampleHeader\": \"<string>\",\n \"headerParams\": [\n {}\n ],\n \"example\": \"<string>\",\n \"extraSettings\": {\n \"addSecurityRecommendation\": true,\n \"codeExpirationMinutes\": 45,\n \"allowChangeCategory\": true\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.jelou.ai/v1/bots/{botId}/templates")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"language\": \"<string>\",\n \"elementName\": \"<string>\",\n \"template\": \"<string>\",\n \"isVisible\": true,\n \"params\": [\n {\n \"param\": \"<string>\",\n \"label\": \"<string>\",\n \"example\": \"<string>\"\n }\n ],\n \"paramsNumber\": 123,\n \"displayName\": \"<string>\",\n \"mediaUrl\": \"<string>\",\n \"buttons\": [\n {\n \"text\": \"<string>\",\n \"url\": \"<string>\",\n \"phone_number\": \"<string>\",\n \"example\": \"<string>\"\n }\n ],\n \"header\": \"<string>\",\n \"exampleHeader\": \"<string>\",\n \"headerParams\": [\n {}\n ],\n \"example\": \"<string>\",\n \"extraSettings\": {\n \"addSecurityRecommendation\": true,\n \"codeExpirationMinutes\": 45,\n \"allowChangeCategory\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.jelou.ai/v1/bots/{botId}/templates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"language\": \"<string>\",\n \"elementName\": \"<string>\",\n \"template\": \"<string>\",\n \"isVisible\": true,\n \"params\": [\n {\n \"param\": \"<string>\",\n \"label\": \"<string>\",\n \"example\": \"<string>\"\n }\n ],\n \"paramsNumber\": 123,\n \"displayName\": \"<string>\",\n \"mediaUrl\": \"<string>\",\n \"buttons\": [\n {\n \"text\": \"<string>\",\n \"url\": \"<string>\",\n \"phone_number\": \"<string>\",\n \"example\": \"<string>\"\n }\n ],\n \"header\": \"<string>\",\n \"exampleHeader\": \"<string>\",\n \"headerParams\": [\n {}\n ],\n \"example\": \"<string>\",\n \"extraSettings\": {\n \"addSecurityRecommendation\": true,\n \"codeExpirationMinutes\": 45,\n \"allowChangeCategory\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"message": [
"<string>"
],
"status": "<string>",
"data": {}
}{
"message": "<string>",
"statusMessage": "<string>",
"status": 123,
"error": {
"code": "<string>",
"key": "<string>",
"description": "<string>",
"developerMessages": {},
"clientMessages": {}
},
"validationError": {}
}{
"message": "<string>",
"statusMessage": "<string>",
"status": 123,
"error": {
"code": "<string>",
"key": "<string>",
"description": "<string>",
"developerMessages": {},
"clientMessages": {}
},
"validationError": {}
}{
"message": "<string>",
"statusMessage": "<string>",
"status": 123,
"error": {
"code": "<string>",
"key": "<string>",
"description": "<string>",
"developerMessages": {},
"clientMessages": {}
},
"validationError": {}
}Crie templates HSM personalizados com parâmetros posicionais, botões interativos e mídia. Opcionalmente, envie o template diretamente ao WhatsApp para aprovação.
POST /v1/bots/{botId}/templates
Templates devem ser aprovados pela equipe do WhatsApp antes de poderem ser usados. Siga as diretrizes da Meta para evitar rejeições.
Parâmetros de Path
| Propriedade | Tipo | Descrição |
|---|---|---|
| botId | string | ID único do bot. Exemplo: 123456789 |
Parâmetros de Query
| Propriedade | Tipo | Descrição |
|---|---|---|
| sendToAprove | boolean | Define se o template deve ser enviado ao WhatsApp para aprovação. |
Corpo da Requisição
| Propriedade | Tipo | Descrição |
|---|---|---|
| category | string | Categoria do template HSM. Valores: UTILITY, MARKETING, AUTHENTICATION |
| language | string | Idioma do template. |
| isVisible | boolean | Define se o template deve ser exibido para os operadores. |
| params | array | Estrutura de parâmetros. Para a categoria de autenticação, a Meta restringiu a um parâmetro. |
| paramsNumber | number | Número de parâmetros. Para a categoria de autenticação, a Meta restringiu a um parâmetro. |
| elementName | string | Identificador único do template. Pode conter apenas letras minúsculas, underscores (_) e números. |
| displayName | string | Nome de exibição do template. |
| template | string | Corpo do template. Para a categoria de autenticação, a Meta restringiu o conteúdo. |
| type | string | Tipo de HSM. Valores: HSM, IMAGE, VIDEO, DOCUMENT |
| mediaUrl | string | URL da mídia. Obrigatório quando o tipo de HSM é IMAGE, VIDEO, DOCUMENT. Não aplicável para a categoria de autenticação. |
| interactiveAction | string | Ação interativa do HSM. Valores: NONE, CALL_TO_ACTION, QUICK_REPLY, OTP |
| buttons | array | Estrutura de botões. Obrigatório quando a ação interativa do HSM é CALL_TO_ACTION, QUICK_REPLY ou OTP. |
| header | string | Cabeçalho do template. Aplicável apenas para templates do tipo texto. Não aplicável para a categoria de autenticação e tem limite de 60 caracteres. |
| exampleHeader | string | Exemplo de cabeçalho. Obrigatório apenas se o template tiver um cabeçalho. |
| headerParams | array | Estrutura de parâmetros. O cabeçalho suporta no máximo um parâmetro. |
| example | string | Exemplo do template. Se o template tiver um parâmetro, ele deve ser substituído por um exemplo. |
| extraSettings | object | Configurações opcionais para o template. |
Exemplos de Requisição
Texto
Texto
curl --request POST \
--url 'https://api.jelou.ai/v1/bots/BOT_ID/templates?sendToAprove=true' \
--header 'Authorization: Basic {{Base64EncodedUsername:Password}}' \
--header 'Content-Type: application/json' \
--data '{
"displayName": "text_template_utility",
"template": "Thank you for your order, {{1}}! Your confirmation number is {{2}}. If you have any questions, contact support.",
"example": "Thank you for your order, Maria! Your confirmation number is 71936. If you have any questions, contact support.",
"elementName": "text_template_utility",
"params": [
{"param": "1", "label": "customer", "example": "Maria"},
{"param": "2", "label": "order", "example": "71936"}
],
"paramsNumber": 2,
"type": "HSM",
"language": "en",
"category": "UTILITY",
"interactiveAction": "NONE"
}'
Texto com botões de resposta rápida
Texto com botões de resposta rápida
curl --request POST \
--url 'https://api.jelou.ai/v1/bots/BOT_ID/templates?sendToAprove=true' \
--header 'Authorization: Basic {{Base64EncodedUsername:Password}}' \
--header 'Content-Type: application/json' \
--data '{
"displayName": "template_quick_reply",
"template": "Thank you for your order, {{1}}! Your confirmation number is {{2}}. Use the buttons to contact us.",
"example": "Thank you for your order, Maria! Your confirmation number is 57893. Use the buttons to contact us.",
"elementName": "template_quick_reply",
"params": [
{"param": "1", "label": "customer", "example": "Maria"},
{"param": "2", "label": "order", "example": "57893"}
],
"paramsNumber": 2,
"type": "HSM",
"language": "en",
"category": "UTILITY",
"interactiveAction": "QUICK_REPLY",
"buttons": [
{"text": "Contact Support", "type": "QUICK_REPLY"},
{"text": "Contact Sales", "type": "QUICK_REPLY"}
]
}'
Texto com botões CTA
Texto com botões CTA
curl --request POST \
--url 'https://api.jelou.ai/v1/bots/BOT_ID/templates?sendToAprove=true' \
--header 'Authorization: Basic {{Base64EncodedUsername:Password}}' \
--header 'Content-Type: application/json' \
--data '{
"displayName": "template_call_action",
"template": "Thank you for your order, {{1}}! Your confirmation number is {{2}}. Use the buttons to contact us.",
"example": "Thank you for your order, Maria! Your confirmation number is 67996. Use the buttons to contact us.",
"elementName": "template_call_action",
"params": [
{"param": "1", "label": "customer", "example": "Maria"},
{"param": "2", "label": "order", "example": "67996"}
],
"paramsNumber": 2,
"type": "HSM",
"language": "en",
"category": "UTILITY",
"interactiveAction": "CALL_TO_ACTION",
"buttons": [
{"text": "Contact Support", "type": "URL", "url": "https://apps.jelou.ai", "example": "https://apps.jelou.ai"},
{"text": "Call", "type": "PHONE_NUMBER", "phone_number": "+PHONE_NUMBER"}
]
}'
Imagem
Imagem
curl --request POST \
--url 'https://api.jelou.ai/v1/bots/BOT_ID/templates?sendToAprove=true' \
--header 'Authorization: Basic {{Base64EncodedUsername:Password}}' \
--header 'Content-Type: application/json' \
--data '{
"displayName": "image_template",
"template": "Hello {{1}}. We invite you to check out our promotions.",
"example": "Hello Maria. We invite you to check out our promotions.",
"elementName": "image_template",
"params": [
{"param": "1", "label": "customer", "example": "Maria"}
],
"paramsNumber": 1,
"type": "IMAGE",
"language": "en",
"category": "MARKETING",
"mediaUrl": "https://cdn.example.com/image.jpeg",
"interactiveAction": "NONE"
}'
Documento
Documento
curl --request POST \
--url 'https://api.jelou.ai/v1/bots/BOT_ID/templates?sendToAprove=true' \
--header 'Authorization: Basic {{Base64EncodedUsername:Password}}' \
--header 'Content-Type: application/json' \
--data '{
"displayName": "document_template",
"template": "Hello {{1}}. Please find your requested document attached.",
"example": "Hello Maria. Please find your requested document attached.",
"elementName": "document_template",
"params": [
{"param": "1", "label": "customer", "example": "Maria"}
],
"paramsNumber": 1,
"type": "DOCUMENT",
"language": "en",
"category": "MARKETING",
"mediaUrl": "https://cdn.example.com/document.pdf",
"interactiveAction": "NONE"
}'
Vídeo
Vídeo
curl --request POST \
--url 'https://api.jelou.ai/v1/bots/BOT_ID/templates?sendToAprove=true' \
--header 'Authorization: Basic {{Base64EncodedUsername:Password}}' \
--header 'Content-Type: application/json' \
--data '{
"displayName": "video_template",
"template": "Hello {{1}}. Watch our new video.",
"example": "Hello Maria. Watch our new video.",
"elementName": "video_template",
"params": [
{"param": "1", "label": "customer", "example": "Maria"}
],
"paramsNumber": 1,
"type": "VIDEO",
"language": "en",
"category": "MARKETING",
"mediaUrl": "https://cdn.example.com/video.mp4",
"interactiveAction": "NONE"
}'
Respostas
200 - Resposta bem-sucedida
200 - Resposta bem-sucedida
{
"message": ["Template has been created."],
"status": "success",
"data": {
"template": "Hello! We are *Jelou*. \nWelcome _{{1}}_. Soon {{2}} from the team will reach out to you.",
"displayName": "Welcome",
"elementName": "test_hsm_api",
"params": [
{"label": "Customer name", "param": "1"},
{"label": "Agent name", "param": "2"}
],
"paramsNumber": 2,
"isVisible": false,
"language": "EN",
"createdAt": "2021-01-28T15:08:38.492Z",
"updatedAt": "2021-01-28T15:08:38.492Z",
"botId": "BOT_ID",
"companyId": 100,
"status": "APPROVED"
}
}
400 - Requisição Inválida
400 - Requisição Inválida
{
"message": ["Template name already exists"],
"status": "failed"
}
401 - Não Autorizado
401 - Não Autorizado
{
"message": "Authentication failed"
}
404 - Não Encontrado
404 - Não Encontrado
{
"message": ["The Bot could not be found at the moment."],
"statusMessage": "failed",
"error": {
"code": "E1019",
"key": "BOT_NOT_FOUND"
}
}
O campo
status na resposta indica se o seu template foi aprovado pelo WhatsApp.Idioma
O idioma suportado pelo WhatsApp está detalhado na página oficial. Por favor, revise cuidadosamente no seguinte link.Restrições de Conteúdo (Categoria de Autenticação)
A Meta restringiu o conteúdo para a categoria de autenticação. O conteúdo será de acordo com o idioma do template. A Meta está restrita a um único parâmetro.Idioma
| Idioma | Código | Conteúdo |
|---|---|---|
| Inglês | en | {{1}} is your verification code. |
| Português (BR) | pt_BR | Seu código de verificação é {{1}}. |
| Espanhol | es | Tu código de verificación es {{1}}. |
Estrutura de Parâmetros
Use a seguinte estrutura no campoparams ao criar um template:
[
{"label": "Customer name", "param": "1"},
{"label": "Order number", "param": "2"}
]
Estrutura de Botões
Use a seguinte estrutura no campobuttons quando as ações interativas forem CALL_TO_ACTION, QUICK_REPLY ou OTP.
QUICK_REPLY
Usado para obter respostas rápidas. É um array de objetos e pode ter no máximo 3 botões.| Propriedade | Descrição |
|---|---|
| text | Texto do botão; este valor não pode ser atualizado. |
| type | Tipo do botão. Valor: QUICK_REPLY |
[
{"text": "More information", "type": "QUICK_REPLY"},
{"text": "Talk to an operator", "type": "QUICK_REPLY"},
{"text": "Sales", "type": "QUICK_REPLY"}
]
CALL_TO_ACTION
Usado para oferecer uma chamada para ação. Pode ter no máximo 2 botões e no máximo 1 botão de cada tipo.| Propriedade | Descrição |
|---|---|
| text | Texto do botão; este valor não pode ser atualizado. |
| type | Tipo do botão. Valores: PHONE_NUMBER, URL |
| phone_number | Número de telefone do botão. |
| url | URL do botão. |
| example | Exemplo de URL. Obrigatório quando o tipo de botão é URL. |
[
{"text": "Sales", "phone_number": "+PHONE_NUMBER", "type": "PHONE_NUMBER"},
{"type": "URL", "text": "View site", "url": "https://apps.jelou.ai/{{1}}", "example": "https://apps.jelou.ai/offers"}
]
OTP
Usado para obter uma “Senha de Uso Único”. Pode ter no máximo 1 botão.| Propriedade | Descrição |
|---|---|
| text | Texto do botão; este valor não pode ser atualizado. |
| type | Tipo do botão. Valor: OTP |
[
{"text": "COPY CODE", "type": "OTP"}
]
Estrutura de extraSettings
| Propriedade | Tipo | Descrição |
|---|---|---|
| addSecurityRecommendation | boolean | Adiciona uma mensagem de segurança adicional em templates de autenticação. |
| codeExpirationMinutes | number | Adiciona uma mensagem de rodapé com o tempo de expiração do código. Valores entre 1 e 90 minutos. |
| allowChangeCategory | boolean | Permite que a Meta atualize a categoria do template se necessário. |
Autorizações
Basic authentication using Base64 encoded clientId:clientSecret
Parâmetros de caminho
Parâmetros de consulta
Corpo
application/json
Opções disponíveis:
UTILITY, MARKETING, AUTHENTICATION Pattern:
^[a-z0-9_]+$Show child attributes
Show child attributes
Opções disponíveis:
HSM, IMAGE, VIDEO, DOCUMENT Opções disponíveis:
NONE, CALL_TO_ACTION, QUICK_REPLY, OTP Show child attributes
Show child attributes
Maximum string length:
60Show child attributes
Show child attributes
Esta página foi útil?
⌘I