Edit a WhatsApp template
curl --request PATCH \
--url http://localhost:8080/whatsapp/templates/{templateId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"components": [
{
"type": "HEADER",
"format": "TEXT",
"text": "<string>",
"example": {
"header_text": [
"<string>"
]
}
}
],
"message_send_ttl_seconds": 0
}
'import requests
url = "http://localhost:8080/whatsapp/templates/{templateId}"
payload = {
"components": [
{
"type": "HEADER",
"format": "TEXT",
"text": "<string>",
"example": { "header_text": ["<string>"] }
}
],
"message_send_ttl_seconds": 0
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
components: [
{
type: 'HEADER',
format: 'TEXT',
text: '<string>',
example: {header_text: ['<string>']}
}
],
message_send_ttl_seconds: 0
})
};
fetch('http://localhost:8080/whatsapp/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_PORT => "8080",
CURLOPT_URL => "http://localhost:8080/whatsapp/templates/{templateId}",
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([
'components' => [
[
'type' => 'HEADER',
'format' => 'TEXT',
'text' => '<string>',
'example' => [
'header_text' => [
'<string>'
]
]
]
],
'message_send_ttl_seconds' => 0
]),
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 := "http://localhost:8080/whatsapp/templates/{templateId}"
payload := strings.NewReader("{\n \"components\": [\n {\n \"type\": \"HEADER\",\n \"format\": \"TEXT\",\n \"text\": \"<string>\",\n \"example\": {\n \"header_text\": [\n \"<string>\"\n ]\n }\n }\n ],\n \"message_send_ttl_seconds\": 0\n}")
req, _ := http.NewRequest("PATCH", 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.patch("http://localhost:8080/whatsapp/templates/{templateId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"components\": [\n {\n \"type\": \"HEADER\",\n \"format\": \"TEXT\",\n \"text\": \"<string>\",\n \"example\": {\n \"header_text\": [\n \"<string>\"\n ]\n }\n }\n ],\n \"message_send_ttl_seconds\": 0\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8080/whatsapp/templates/{templateId}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"components\": [\n {\n \"type\": \"HEADER\",\n \"format\": \"TEXT\",\n \"text\": \"<string>\",\n \"example\": {\n \"header_text\": [\n \"<string>\"\n ]\n }\n }\n ],\n \"message_send_ttl_seconds\": 0\n}"
response = http.request(request)
puts response.read_body{
"success": true
}{
"statusCode": 123,
"message": "<string>",
"error": "<string>"
}AI WhatsApp
Edit a WhatsApp template
Edit a WhatsApp template’s components, category or validity period and resubmit it to Meta for approval. Name and language cannot change.
PATCH
/
whatsapp
/
templates
/
{templateId}
Edit a WhatsApp template
curl --request PATCH \
--url http://localhost:8080/whatsapp/templates/{templateId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"components": [
{
"type": "HEADER",
"format": "TEXT",
"text": "<string>",
"example": {
"header_text": [
"<string>"
]
}
}
],
"message_send_ttl_seconds": 0
}
'import requests
url = "http://localhost:8080/whatsapp/templates/{templateId}"
payload = {
"components": [
{
"type": "HEADER",
"format": "TEXT",
"text": "<string>",
"example": { "header_text": ["<string>"] }
}
],
"message_send_ttl_seconds": 0
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
components: [
{
type: 'HEADER',
format: 'TEXT',
text: '<string>',
example: {header_text: ['<string>']}
}
],
message_send_ttl_seconds: 0
})
};
fetch('http://localhost:8080/whatsapp/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_PORT => "8080",
CURLOPT_URL => "http://localhost:8080/whatsapp/templates/{templateId}",
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([
'components' => [
[
'type' => 'HEADER',
'format' => 'TEXT',
'text' => '<string>',
'example' => [
'header_text' => [
'<string>'
]
]
]
],
'message_send_ttl_seconds' => 0
]),
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 := "http://localhost:8080/whatsapp/templates/{templateId}"
payload := strings.NewReader("{\n \"components\": [\n {\n \"type\": \"HEADER\",\n \"format\": \"TEXT\",\n \"text\": \"<string>\",\n \"example\": {\n \"header_text\": [\n \"<string>\"\n ]\n }\n }\n ],\n \"message_send_ttl_seconds\": 0\n}")
req, _ := http.NewRequest("PATCH", 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.patch("http://localhost:8080/whatsapp/templates/{templateId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"components\": [\n {\n \"type\": \"HEADER\",\n \"format\": \"TEXT\",\n \"text\": \"<string>\",\n \"example\": {\n \"header_text\": [\n \"<string>\"\n ]\n }\n }\n ],\n \"message_send_ttl_seconds\": 0\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8080/whatsapp/templates/{templateId}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"components\": [\n {\n \"type\": \"HEADER\",\n \"format\": \"TEXT\",\n \"text\": \"<string>\",\n \"example\": {\n \"header_text\": [\n \"<string>\"\n ]\n }\n }\n ],\n \"message_send_ttl_seconds\": 0\n}"
response = http.request(request)
puts response.read_body{
"success": true
}{
"statusCode": 123,
"message": "<string>",
"error": "<string>"
}Send only the fields you are changing. After an edit the template goes back to
PENDING until Meta approves it; a send that uses it in the meantime is refused with 422 template_pending. Meta’s own limits on how often a template can be edited come back as 400 errors with Meta’s reason.
Requires the whatsapp:write scope.Authorizations
Body
application/json
Was this page helpful?