Edit a WhatsApp template
Header, body, footer, buttons or authentication settings; name, language and category stay. Sent to Meta for a new review (Meta limits the edits of an approved template); refused by Meta, the template stays as it was. A published authentication template cannot be edited.
curl --request PATCH \
--url https://shortext.ny-corp.io/api/v2.0/templates/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"channel_id": "<string>",
"name": "<string>",
"language": "fr",
"header": {
"text": "<string>",
"examples": {},
"media_url": "<string>"
},
"body": {
"text": "Hello {{name}}, your order {{order_number}} is ready.",
"examples": {
"name": "Awa",
"order_number": "A-42"
}
},
"footer": "<string>",
"buttons": [
{
"text": "<string>",
"url": "https://shop.example/orders/{{1}}",
"example": "<string>",
"phone_number": "+237690000000"
}
],
"authentication": {
"add_security_recommendation": true,
"code_expiration_minutes": 45,
"otp_type": "COPY_CODE",
"package_name": "<string>",
"signature_hash": "<string>"
}
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://shortext.ny-corp.io/api/v2.0/templates/{id}",
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([
'channel_id' => '<string>',
'name' => '<string>',
'language' => 'fr',
'header' => [
'text' => '<string>',
'examples' => [
],
'media_url' => '<string>'
],
'body' => [
'text' => 'Hello {{name}}, your order {{order_number}} is ready.',
'examples' => [
'name' => 'Awa',
'order_number' => 'A-42'
]
],
'footer' => '<string>',
'buttons' => [
[
'text' => '<string>',
'url' => 'https://shop.example/orders/{{1}}',
'example' => '<string>',
'phone_number' => '+237690000000'
]
],
'authentication' => [
'add_security_recommendation' => true,
'code_expiration_minutes' => 45,
'otp_type' => 'COPY_CODE',
'package_name' => '<string>',
'signature_hash' => '<string>'
]
]),
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;
}const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
channel_id: '<string>',
name: '<string>',
language: 'fr',
header: {text: '<string>', examples: {}, media_url: '<string>'},
body: JSON.stringify({
text: 'Hello {{name}}, your order {{order_number}} is ready.',
examples: {name: 'Awa', order_number: 'A-42'}
}),
footer: '<string>',
buttons: [
{
text: '<string>',
url: 'https://shop.example/orders/{{1}}',
example: '<string>',
phone_number: '+237690000000'
}
],
authentication: {
add_security_recommendation: true,
code_expiration_minutes: 45,
otp_type: 'COPY_CODE',
package_name: '<string>',
signature_hash: '<string>'
}
})
};
fetch('https://shortext.ny-corp.io/api/v2.0/templates/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://shortext.ny-corp.io/api/v2.0/templates/{id}"
payload = {
"channel_id": "<string>",
"name": "<string>",
"language": "fr",
"header": {
"text": "<string>",
"examples": {},
"media_url": "<string>"
},
"body": {
"text": "Hello {{name}}, your order {{order_number}} is ready.",
"examples": {
"name": "Awa",
"order_number": "A-42"
}
},
"footer": "<string>",
"buttons": [
{
"text": "<string>",
"url": "https://shop.example/orders/{{1}}",
"example": "<string>",
"phone_number": "+237690000000"
}
],
"authentication": {
"add_security_recommendation": True,
"code_expiration_minutes": 45,
"otp_type": "COPY_CODE",
"package_name": "<string>",
"signature_hash": "<string>"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text){
"success": true,
"code": 1000,
"message": "Request success.",
"body": {
"id": "<string>",
"name": "order_update",
"language": "fr",
"status": "APPROVED",
"rejection_reason": "<string>",
"quality": "GREEN",
"category": "UTILITY",
"channels": [
"<string>"
],
"header": {
"type": "NONE",
"text": "<string>",
"variables": [
"<string>"
],
"media_url": "<string>"
},
"body": {
"text": "Hello {{name}}, your order {{order}} is ready.",
"variables": [
"name",
"order"
]
},
"footer": "<string>",
"buttons": [
{
"index": 0,
"type": "URL",
"text": "<string>",
"needs_value": true
}
],
"updated_at": "2023-11-07T05:31:56Z"
},
"token": "<string>",
"trace_id": "<string>"
}Authorizations
Company API key, sent as Authorization: Bearer <key>. Create it in the dashboard (Developer > API Keys) with the permissions the integration needs.
Path Parameters
Body
Creation: a WhatsApp number of the company; the template belongs to its WhatsApp Business Account and every number of that account can send it
Creation: normalized for Meta (Order update becomes order_update)
Creation
"fr"
Creation. A utility body has at least one variable; an authentication template only takes authentication
MARKETING, UTILITY, AUTHENTICATION Show child attributes
Show child attributes
Show child attributes
Show child attributes
60 characters, no variable
Up to 10: quick replies grouped together, 2 links, 1 call, 1 copy code (marketing). A link with {{1}} at the end of the URL needs an example
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Response
Always HTTP 200: the outcome is in success and code (absolute value of the response code).
curl --request PATCH \
--url https://shortext.ny-corp.io/api/v2.0/templates/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"channel_id": "<string>",
"name": "<string>",
"language": "fr",
"header": {
"text": "<string>",
"examples": {},
"media_url": "<string>"
},
"body": {
"text": "Hello {{name}}, your order {{order_number}} is ready.",
"examples": {
"name": "Awa",
"order_number": "A-42"
}
},
"footer": "<string>",
"buttons": [
{
"text": "<string>",
"url": "https://shop.example/orders/{{1}}",
"example": "<string>",
"phone_number": "+237690000000"
}
],
"authentication": {
"add_security_recommendation": true,
"code_expiration_minutes": 45,
"otp_type": "COPY_CODE",
"package_name": "<string>",
"signature_hash": "<string>"
}
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://shortext.ny-corp.io/api/v2.0/templates/{id}",
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([
'channel_id' => '<string>',
'name' => '<string>',
'language' => 'fr',
'header' => [
'text' => '<string>',
'examples' => [
],
'media_url' => '<string>'
],
'body' => [
'text' => 'Hello {{name}}, your order {{order_number}} is ready.',
'examples' => [
'name' => 'Awa',
'order_number' => 'A-42'
]
],
'footer' => '<string>',
'buttons' => [
[
'text' => '<string>',
'url' => 'https://shop.example/orders/{{1}}',
'example' => '<string>',
'phone_number' => '+237690000000'
]
],
'authentication' => [
'add_security_recommendation' => true,
'code_expiration_minutes' => 45,
'otp_type' => 'COPY_CODE',
'package_name' => '<string>',
'signature_hash' => '<string>'
]
]),
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;
}const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
channel_id: '<string>',
name: '<string>',
language: 'fr',
header: {text: '<string>', examples: {}, media_url: '<string>'},
body: JSON.stringify({
text: 'Hello {{name}}, your order {{order_number}} is ready.',
examples: {name: 'Awa', order_number: 'A-42'}
}),
footer: '<string>',
buttons: [
{
text: '<string>',
url: 'https://shop.example/orders/{{1}}',
example: '<string>',
phone_number: '+237690000000'
}
],
authentication: {
add_security_recommendation: true,
code_expiration_minutes: 45,
otp_type: 'COPY_CODE',
package_name: '<string>',
signature_hash: '<string>'
}
})
};
fetch('https://shortext.ny-corp.io/api/v2.0/templates/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://shortext.ny-corp.io/api/v2.0/templates/{id}"
payload = {
"channel_id": "<string>",
"name": "<string>",
"language": "fr",
"header": {
"text": "<string>",
"examples": {},
"media_url": "<string>"
},
"body": {
"text": "Hello {{name}}, your order {{order_number}} is ready.",
"examples": {
"name": "Awa",
"order_number": "A-42"
}
},
"footer": "<string>",
"buttons": [
{
"text": "<string>",
"url": "https://shop.example/orders/{{1}}",
"example": "<string>",
"phone_number": "+237690000000"
}
],
"authentication": {
"add_security_recommendation": True,
"code_expiration_minutes": 45,
"otp_type": "COPY_CODE",
"package_name": "<string>",
"signature_hash": "<string>"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text){
"success": true,
"code": 1000,
"message": "Request success.",
"body": {
"id": "<string>",
"name": "order_update",
"language": "fr",
"status": "APPROVED",
"rejection_reason": "<string>",
"quality": "GREEN",
"category": "UTILITY",
"channels": [
"<string>"
],
"header": {
"type": "NONE",
"text": "<string>",
"variables": [
"<string>"
],
"media_url": "<string>"
},
"body": {
"text": "Hello {{name}}, your order {{order}} is ready.",
"variables": [
"name",
"order"
]
},
"footer": "<string>",
"buttons": [
{
"index": 0,
"type": "URL",
"text": "<string>",
"needs_value": true
}
],
"updated_at": "2023-11-07T05:31:56Z"
},
"token": "<string>",
"trace_id": "<string>"
}