curl --request PATCH \
--url https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/inboxes/{inboxId}/message-templates/{name} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'cloudchat-instance: <cloudchat-instance>' \
--data '
{
"template": {
"language": "en_US",
"components": [
{
"format": "TEXT",
"text": "<string>",
"example": {
"body_text": [
[
"<string>"
]
],
"body_text_named_params": [
{
"param_name": "customer_name",
"example": "Ana"
}
]
},
"buttons": [
{
"text": "<string>",
"url": "<string>",
"phone_number": "<string>",
"otp_type": "COPY_CODE",
"example": [
"<string>"
]
}
],
"add_security_recommendation": true,
"code_expiration_minutes": 123
}
]
}
}
'import requests
url = "https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/inboxes/{inboxId}/message-templates/{name}"
payload = { "template": {
"language": "en_US",
"components": [
{
"format": "TEXT",
"text": "<string>",
"example": {
"body_text": [["<string>"]],
"body_text_named_params": [
{
"param_name": "customer_name",
"example": "Ana"
}
]
},
"buttons": [
{
"text": "<string>",
"url": "<string>",
"phone_number": "<string>",
"otp_type": "COPY_CODE",
"example": ["<string>"]
}
],
"add_security_recommendation": True,
"code_expiration_minutes": 123
}
]
} }
headers = {
"cloudchat-instance": "<cloudchat-instance>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
'cloudchat-instance': '<cloudchat-instance>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
template: {
language: 'en_US',
components: [
{
format: 'TEXT',
text: '<string>',
example: {
body_text: [['<string>']],
body_text_named_params: [{param_name: 'customer_name', example: 'Ana'}]
},
buttons: [
{
text: '<string>',
url: '<string>',
phone_number: '<string>',
otp_type: 'COPY_CODE',
example: ['<string>']
}
],
add_security_recommendation: true,
code_expiration_minutes: 123
}
]
}
})
};
fetch('https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/inboxes/{inboxId}/message-templates/{name}', 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.cloudhumans.com/cloudchat/v1/accounts/{accountId}/inboxes/{inboxId}/message-templates/{name}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'template' => [
'language' => 'en_US',
'components' => [
[
'format' => 'TEXT',
'text' => '<string>',
'example' => [
'body_text' => [
[
'<string>'
]
],
'body_text_named_params' => [
[
'param_name' => 'customer_name',
'example' => 'Ana'
]
]
],
'buttons' => [
[
'text' => '<string>',
'url' => '<string>',
'phone_number' => '<string>',
'otp_type' => 'COPY_CODE',
'example' => [
'<string>'
]
]
],
'add_security_recommendation' => true,
'code_expiration_minutes' => 123
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"cloudchat-instance: <cloudchat-instance>"
],
]);
$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.cloudhumans.com/cloudchat/v1/accounts/{accountId}/inboxes/{inboxId}/message-templates/{name}"
payload := strings.NewReader("{\n \"template\": {\n \"language\": \"en_US\",\n \"components\": [\n {\n \"format\": \"TEXT\",\n \"text\": \"<string>\",\n \"example\": {\n \"body_text\": [\n [\n \"<string>\"\n ]\n ],\n \"body_text_named_params\": [\n {\n \"param_name\": \"customer_name\",\n \"example\": \"Ana\"\n }\n ]\n },\n \"buttons\": [\n {\n \"text\": \"<string>\",\n \"url\": \"<string>\",\n \"phone_number\": \"<string>\",\n \"otp_type\": \"COPY_CODE\",\n \"example\": [\n \"<string>\"\n ]\n }\n ],\n \"add_security_recommendation\": true,\n \"code_expiration_minutes\": 123\n }\n ]\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("cloudchat-instance", "<cloudchat-instance>")
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.patch("https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/inboxes/{inboxId}/message-templates/{name}")
.header("cloudchat-instance", "<cloudchat-instance>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"template\": {\n \"language\": \"en_US\",\n \"components\": [\n {\n \"format\": \"TEXT\",\n \"text\": \"<string>\",\n \"example\": {\n \"body_text\": [\n [\n \"<string>\"\n ]\n ],\n \"body_text_named_params\": [\n {\n \"param_name\": \"customer_name\",\n \"example\": \"Ana\"\n }\n ]\n },\n \"buttons\": [\n {\n \"text\": \"<string>\",\n \"url\": \"<string>\",\n \"phone_number\": \"<string>\",\n \"otp_type\": \"COPY_CODE\",\n \"example\": [\n \"<string>\"\n ]\n }\n ],\n \"add_security_recommendation\": true,\n \"code_expiration_minutes\": 123\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/inboxes/{inboxId}/message-templates/{name}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["cloudchat-instance"] = '<cloudchat-instance>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"template\": {\n \"language\": \"en_US\",\n \"components\": [\n {\n \"format\": \"TEXT\",\n \"text\": \"<string>\",\n \"example\": {\n \"body_text\": [\n [\n \"<string>\"\n ]\n ],\n \"body_text_named_params\": [\n {\n \"param_name\": \"customer_name\",\n \"example\": \"Ana\"\n }\n ]\n },\n \"buttons\": [\n {\n \"text\": \"<string>\",\n \"url\": \"<string>\",\n \"phone_number\": \"<string>\",\n \"otp_type\": \"COPY_CODE\",\n \"example\": [\n \"<string>\"\n ]\n }\n ],\n \"add_security_recommendation\": true,\n \"code_expiration_minutes\": 123\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "1157693219400316",
"name": "order_shipped",
"language": "en_US",
"category": "UTILITY"
}{
"error": {
"code": "bad_request",
"message": "The request is malformed."
}
}{
"error": {
"code": "unauthorized",
"message": "Authentication is required. Send a valid Bearer token in the Authorization header."
}
}{
"error": {
"code": "forbidden",
"message": "This account is suspended."
}
}{
"error": {
"code": "not_found",
"message": "Resource could not be found.",
"details": [
{
"field": "name",
"code": "not_found",
"message": "This inbox has no template named reactivation_september in that language. Templates created in the last few minutes may not have synced yet."
}
]
}
}{
"error": {
"code": "validation_failed",
"message": "The request payload is invalid.",
"details": [
{
"field": "template",
"code": "meta_rejected",
"message": "You can only edit an approved template once every 24 hours. Please wait and try again later."
}
]
}
}{
"message": "API rate limit exceeded"
}{
"error": {
"code": "internal_error",
"message": "An unexpected error occurred. Please try again later."
}
}{
"error": {
"code": "service_unavailable",
"message": "WhatsApp did not answer in time. Check the template before retrying: it may already have been submitted."
}
}Update a message template
Edits an existing WhatsApp template and sends it back to Meta for review.
The edit replaces every component. Send the complete set the template should have afterwards, not only the part that changes. The template is identified by name in the path and language in the body, and has to exist in the synced catalogue of this inbox; otherwise the call answers 404 with code not_found in error.details. A template created a few minutes ago may not have synced yet. Names and languages come from List message templates, which shows approved templates only.
Administrators only, and only on an official WhatsApp Cloud API inbox (any other answers 422 with code unsupported_channel). name, category and language cannot be changed: sending name or category answers 422 with code not_editable, and a different language is a different template, so create a new one instead. Headers are text only, and the variable and button rules of Create a message template apply.
Meta decides what can be edited and says no with 422 and code meta_rejected. Only templates that are approved, rejected or paused can be edited, and Meta limits how often an approved template can be edited. The answer carries id, name, language and category but no status: success only means Meta accepted the resubmission for review.
curl --request PATCH \
--url https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/inboxes/{inboxId}/message-templates/{name} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'cloudchat-instance: <cloudchat-instance>' \
--data '
{
"template": {
"language": "en_US",
"components": [
{
"format": "TEXT",
"text": "<string>",
"example": {
"body_text": [
[
"<string>"
]
],
"body_text_named_params": [
{
"param_name": "customer_name",
"example": "Ana"
}
]
},
"buttons": [
{
"text": "<string>",
"url": "<string>",
"phone_number": "<string>",
"otp_type": "COPY_CODE",
"example": [
"<string>"
]
}
],
"add_security_recommendation": true,
"code_expiration_minutes": 123
}
]
}
}
'import requests
url = "https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/inboxes/{inboxId}/message-templates/{name}"
payload = { "template": {
"language": "en_US",
"components": [
{
"format": "TEXT",
"text": "<string>",
"example": {
"body_text": [["<string>"]],
"body_text_named_params": [
{
"param_name": "customer_name",
"example": "Ana"
}
]
},
"buttons": [
{
"text": "<string>",
"url": "<string>",
"phone_number": "<string>",
"otp_type": "COPY_CODE",
"example": ["<string>"]
}
],
"add_security_recommendation": True,
"code_expiration_minutes": 123
}
]
} }
headers = {
"cloudchat-instance": "<cloudchat-instance>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
'cloudchat-instance': '<cloudchat-instance>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
template: {
language: 'en_US',
components: [
{
format: 'TEXT',
text: '<string>',
example: {
body_text: [['<string>']],
body_text_named_params: [{param_name: 'customer_name', example: 'Ana'}]
},
buttons: [
{
text: '<string>',
url: '<string>',
phone_number: '<string>',
otp_type: 'COPY_CODE',
example: ['<string>']
}
],
add_security_recommendation: true,
code_expiration_minutes: 123
}
]
}
})
};
fetch('https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/inboxes/{inboxId}/message-templates/{name}', 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.cloudhumans.com/cloudchat/v1/accounts/{accountId}/inboxes/{inboxId}/message-templates/{name}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'template' => [
'language' => 'en_US',
'components' => [
[
'format' => 'TEXT',
'text' => '<string>',
'example' => [
'body_text' => [
[
'<string>'
]
],
'body_text_named_params' => [
[
'param_name' => 'customer_name',
'example' => 'Ana'
]
]
],
'buttons' => [
[
'text' => '<string>',
'url' => '<string>',
'phone_number' => '<string>',
'otp_type' => 'COPY_CODE',
'example' => [
'<string>'
]
]
],
'add_security_recommendation' => true,
'code_expiration_minutes' => 123
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"cloudchat-instance: <cloudchat-instance>"
],
]);
$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.cloudhumans.com/cloudchat/v1/accounts/{accountId}/inboxes/{inboxId}/message-templates/{name}"
payload := strings.NewReader("{\n \"template\": {\n \"language\": \"en_US\",\n \"components\": [\n {\n \"format\": \"TEXT\",\n \"text\": \"<string>\",\n \"example\": {\n \"body_text\": [\n [\n \"<string>\"\n ]\n ],\n \"body_text_named_params\": [\n {\n \"param_name\": \"customer_name\",\n \"example\": \"Ana\"\n }\n ]\n },\n \"buttons\": [\n {\n \"text\": \"<string>\",\n \"url\": \"<string>\",\n \"phone_number\": \"<string>\",\n \"otp_type\": \"COPY_CODE\",\n \"example\": [\n \"<string>\"\n ]\n }\n ],\n \"add_security_recommendation\": true,\n \"code_expiration_minutes\": 123\n }\n ]\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("cloudchat-instance", "<cloudchat-instance>")
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.patch("https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/inboxes/{inboxId}/message-templates/{name}")
.header("cloudchat-instance", "<cloudchat-instance>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"template\": {\n \"language\": \"en_US\",\n \"components\": [\n {\n \"format\": \"TEXT\",\n \"text\": \"<string>\",\n \"example\": {\n \"body_text\": [\n [\n \"<string>\"\n ]\n ],\n \"body_text_named_params\": [\n {\n \"param_name\": \"customer_name\",\n \"example\": \"Ana\"\n }\n ]\n },\n \"buttons\": [\n {\n \"text\": \"<string>\",\n \"url\": \"<string>\",\n \"phone_number\": \"<string>\",\n \"otp_type\": \"COPY_CODE\",\n \"example\": [\n \"<string>\"\n ]\n }\n ],\n \"add_security_recommendation\": true,\n \"code_expiration_minutes\": 123\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cloudhumans.com/cloudchat/v1/accounts/{accountId}/inboxes/{inboxId}/message-templates/{name}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["cloudchat-instance"] = '<cloudchat-instance>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"template\": {\n \"language\": \"en_US\",\n \"components\": [\n {\n \"format\": \"TEXT\",\n \"text\": \"<string>\",\n \"example\": {\n \"body_text\": [\n [\n \"<string>\"\n ]\n ],\n \"body_text_named_params\": [\n {\n \"param_name\": \"customer_name\",\n \"example\": \"Ana\"\n }\n ]\n },\n \"buttons\": [\n {\n \"text\": \"<string>\",\n \"url\": \"<string>\",\n \"phone_number\": \"<string>\",\n \"otp_type\": \"COPY_CODE\",\n \"example\": [\n \"<string>\"\n ]\n }\n ],\n \"add_security_recommendation\": true,\n \"code_expiration_minutes\": 123\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "1157693219400316",
"name": "order_shipped",
"language": "en_US",
"category": "UTILITY"
}{
"error": {
"code": "bad_request",
"message": "The request is malformed."
}
}{
"error": {
"code": "unauthorized",
"message": "Authentication is required. Send a valid Bearer token in the Authorization header."
}
}{
"error": {
"code": "forbidden",
"message": "This account is suspended."
}
}{
"error": {
"code": "not_found",
"message": "Resource could not be found.",
"details": [
{
"field": "name",
"code": "not_found",
"message": "This inbox has no template named reactivation_september in that language. Templates created in the last few minutes may not have synced yet."
}
]
}
}{
"error": {
"code": "validation_failed",
"message": "The request payload is invalid.",
"details": [
{
"field": "template",
"code": "meta_rejected",
"message": "You can only edit an approved template once every 24 hours. Please wait and try again later."
}
]
}
}{
"message": "API rate limit exceeded"
}{
"error": {
"code": "internal_error",
"message": "An unexpected error occurred. Please try again later."
}
}{
"error": {
"code": "service_unavailable",
"message": "WhatsApp did not answer in time. Check the template before retrying: it may already have been submitted."
}
}Authorizations
Headers
Your Cloud Chat instance ID — an integer, fixed for your company, told at onboarding. The API overview explains how instances work, how to find yours, and the errors a wrong or missing value produces.
1
Path Parameters
Name of the template to edit, exactly as List message templates returns it. It cannot be changed.
"reactivation_september"
Your Cloud Chat account. It has to be an account your token grants membership on, and it has to live on the instance in the cloudchat-instance header — the two travel together. Account numbers are only unique within an instance, so the same number is a different company on another instance. Usually a mismatched pair fails closed with a 401, because your user does not exist on the other instance — but if your identity happens to exist on both, the call succeeds against the other company's data, silently. Read it and you are looking at the wrong help center; write it and you have stored into the wrong account. Send the two values that were given to you together, and never try a number to see what answers.
1
Body
Response
Meta accepted the edit for review.
A template whose edit Meta accepted for review.