Edit template
curl --request PUT \
--url https://api.hubmessage.io/whatsapp/businesses/{wabaId}/templates/{templateId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "order_update_v1",
"category": "UTILITY",
"language": "en_US",
"components": [
{
"type": "BODY",
"text": "Hello {{1}}, your order {{2}} has been updated to {{3}}.",
"example": {
"body_text": [
[
"Ana",
"ORD-1024",
"in transit"
]
]
}
}
]
}
'import requests
url = "https://api.hubmessage.io/whatsapp/businesses/{wabaId}/templates/{templateId}"
payload = {
"name": "order_update_v1",
"category": "UTILITY",
"language": "en_US",
"components": [
{
"type": "BODY",
"text": "Hello {{1}}, your order {{2}} has been updated to {{3}}.",
"example": { "body_text": [["Ana", "ORD-1024", "in transit"]] }
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'order_update_v1',
category: 'UTILITY',
language: 'en_US',
components: [
{
type: 'BODY',
text: 'Hello {{1}}, your order {{2}} has been updated to {{3}}.',
example: {body_text: [['Ana', 'ORD-1024', 'in transit']]}
}
]
})
};
fetch('https://api.hubmessage.io/whatsapp/businesses/{wabaId}/templates/{templateId}', 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.hubmessage.io/whatsapp/businesses/{wabaId}/templates/{templateId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'order_update_v1',
'category' => 'UTILITY',
'language' => 'en_US',
'components' => [
[
'type' => 'BODY',
'text' => 'Hello {{1}}, your order {{2}} has been updated to {{3}}.',
'example' => [
'body_text' => [
[
'Ana',
'ORD-1024',
'in transit'
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.hubmessage.io/whatsapp/businesses/{wabaId}/templates/{templateId}"
payload := strings.NewReader("{\n \"name\": \"order_update_v1\",\n \"category\": \"UTILITY\",\n \"language\": \"en_US\",\n \"components\": [\n {\n \"type\": \"BODY\",\n \"text\": \"Hello {{1}}, your order {{2}} has been updated to {{3}}.\",\n \"example\": {\n \"body_text\": [\n [\n \"Ana\",\n \"ORD-1024\",\n \"in transit\"\n ]\n ]\n }\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.put("https://api.hubmessage.io/whatsapp/businesses/{wabaId}/templates/{templateId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"order_update_v1\",\n \"category\": \"UTILITY\",\n \"language\": \"en_US\",\n \"components\": [\n {\n \"type\": \"BODY\",\n \"text\": \"Hello {{1}}, your order {{2}} has been updated to {{3}}.\",\n \"example\": {\n \"body_text\": [\n [\n \"Ana\",\n \"ORD-1024\",\n \"in transit\"\n ]\n ]\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hubmessage.io/whatsapp/businesses/{wabaId}/templates/{templateId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"order_update_v1\",\n \"category\": \"UTILITY\",\n \"language\": \"en_US\",\n \"components\": [\n {\n \"type\": \"BODY\",\n \"text\": \"Hello {{1}}, your order {{2}} has been updated to {{3}}.\",\n \"example\": {\n \"body_text\": [\n [\n \"Ana\",\n \"ORD-1024\",\n \"in transit\"\n ]\n ]\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true
}{
"error": "Newport request failed",
"value": {
"errors": [
{
"description": "",
"name": "META_WHATSAPP_ERROR",
"message": "Your message could not be sent because it contains content that other people on Facebook have reported as abusive.",
"code": "368"
}
]
}
}{
"error": 401,
"message": "Unauthorized"
}Templates
Editar template
Edite um template existente e reenvie para aprovação
PUT
/
whatsapp
/
businesses
/
{wabaId}
/
templates
/
{templateId}
Edit template
curl --request PUT \
--url https://api.hubmessage.io/whatsapp/businesses/{wabaId}/templates/{templateId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "order_update_v1",
"category": "UTILITY",
"language": "en_US",
"components": [
{
"type": "BODY",
"text": "Hello {{1}}, your order {{2}} has been updated to {{3}}.",
"example": {
"body_text": [
[
"Ana",
"ORD-1024",
"in transit"
]
]
}
}
]
}
'import requests
url = "https://api.hubmessage.io/whatsapp/businesses/{wabaId}/templates/{templateId}"
payload = {
"name": "order_update_v1",
"category": "UTILITY",
"language": "en_US",
"components": [
{
"type": "BODY",
"text": "Hello {{1}}, your order {{2}} has been updated to {{3}}.",
"example": { "body_text": [["Ana", "ORD-1024", "in transit"]] }
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'order_update_v1',
category: 'UTILITY',
language: 'en_US',
components: [
{
type: 'BODY',
text: 'Hello {{1}}, your order {{2}} has been updated to {{3}}.',
example: {body_text: [['Ana', 'ORD-1024', 'in transit']]}
}
]
})
};
fetch('https://api.hubmessage.io/whatsapp/businesses/{wabaId}/templates/{templateId}', 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.hubmessage.io/whatsapp/businesses/{wabaId}/templates/{templateId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'order_update_v1',
'category' => 'UTILITY',
'language' => 'en_US',
'components' => [
[
'type' => 'BODY',
'text' => 'Hello {{1}}, your order {{2}} has been updated to {{3}}.',
'example' => [
'body_text' => [
[
'Ana',
'ORD-1024',
'in transit'
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.hubmessage.io/whatsapp/businesses/{wabaId}/templates/{templateId}"
payload := strings.NewReader("{\n \"name\": \"order_update_v1\",\n \"category\": \"UTILITY\",\n \"language\": \"en_US\",\n \"components\": [\n {\n \"type\": \"BODY\",\n \"text\": \"Hello {{1}}, your order {{2}} has been updated to {{3}}.\",\n \"example\": {\n \"body_text\": [\n [\n \"Ana\",\n \"ORD-1024\",\n \"in transit\"\n ]\n ]\n }\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.put("https://api.hubmessage.io/whatsapp/businesses/{wabaId}/templates/{templateId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"order_update_v1\",\n \"category\": \"UTILITY\",\n \"language\": \"en_US\",\n \"components\": [\n {\n \"type\": \"BODY\",\n \"text\": \"Hello {{1}}, your order {{2}} has been updated to {{3}}.\",\n \"example\": {\n \"body_text\": [\n [\n \"Ana\",\n \"ORD-1024\",\n \"in transit\"\n ]\n ]\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hubmessage.io/whatsapp/businesses/{wabaId}/templates/{templateId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"order_update_v1\",\n \"category\": \"UTILITY\",\n \"language\": \"en_US\",\n \"components\": [\n {\n \"type\": \"BODY\",\n \"text\": \"Hello {{1}}, your order {{2}} has been updated to {{3}}.\",\n \"example\": {\n \"body_text\": [\n [\n \"Ana\",\n \"ORD-1024\",\n \"in transit\"\n ]\n ]\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true
}{
"error": "Newport request failed",
"value": {
"errors": [
{
"description": "",
"name": "META_WHATSAPP_ERROR",
"message": "Your message could not be sent because it contains content that other people on Facebook have reported as abusive.",
"code": "368"
}
]
}
}{
"error": 401,
"message": "Unauthorized"
}Conceituação
Edita um template existente e reenvia para aprovação da Meta. O body é o mesmo utilizado na criação do template.Ao editar um template aprovado, ele volta para o status
PENDING até ser revisado novamente pela Meta.O
templateId é obtido através do endpoint de Listar templates.Autorizações
Secret Key generated in the Hub Message Security panel
Parâmetros de caminho
WABA ID (obtained via List WABAs)
Exemplo:
"428083093730937"
Template ID (obtained via List templates)
Exemplo:
"1900296177408890"
Corpo
application/json
Template name (snake_case, no spaces)
Template category
Opções disponíveis:
UTILITY, MARKETING, AUTHENTICATION Template language (e.g. en_US, pt_BR)
Template components (HEADER, BODY, FOOTER, BUTTONS)
Resposta
Template edited successfully
Indicates whether the operation was successful
⌘I