curl -X PATCH https://tawked.com/v1/whatsapp/templates/7000 \
-H "Authorization: Bearer tk_live_xxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order_received_v1-ar-2" \
-d '{
"category": "UTILITY",
"header": "طلبك {{1}}",
"body": "استلمنا طلبك رقم {{1}} بقيمة {{2}} ريال، ونبلغك عند شحنه.",
"buttons": [
{
"type": "URL",
"text": "تتبع الطلب",
"url": "https://flowers.example/orders/{{1}}"
}
],
"examples": {
"header:1": "1042",
"body:1": "1042",
"body:2": "250",
"button:0": "1042"
}
}'const res = await fetch("https://tawked.com/v1/whatsapp/templates/7000", {
method: "PATCH",
headers: {
Authorization: "Bearer tk_live_xxxxxxxxxxxxxxxxxxxx",
"Content-Type": "application/json",
"Idempotency-Key": "order_received_v1-ar-2",
},
body: JSON.stringify({
"category": "UTILITY",
"header": "طلبك {{1}}",
"body": "استلمنا طلبك رقم {{1}} بقيمة {{2}} ريال، ونبلغك عند شحنه.",
"buttons": [
{
"type": "URL",
"text": "تتبع الطلب",
"url": "https://flowers.example/orders/{{1}}"
}
],
"examples": {
"header:1": "1042",
"body:1": "1042",
"body:2": "250",
"button:0": "1042"
}
}),
});
const data = await res.json();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://tawked.com/v1/whatsapp/templates/{template_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([
'category' => '<string>',
'body' => '<string>',
'header' => '<string>',
'footer' => '<string>',
'buttons' => '<array>',
'examples' => [
]
]),
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;
}import requests
res = requests.patch(
"https://tawked.com/v1/whatsapp/templates/7000",
headers={"Authorization": "Bearer tk_live_xxxxxxxxxxxxxxxxxxxx", "Idempotency-Key": "order_received_v1-ar-2"},
json={
"category": "UTILITY",
"header": "طلبك {{1}}",
"body": "استلمنا طلبك رقم {{1}} بقيمة {{2}} ريال، ونبلغك عند شحنه.",
"buttons": [
{
"type": "URL",
"text": "تتبع الطلب",
"url": "https://flowers.example/orders/{{1}}"
}
],
"examples": {
"header:1": "1042",
"body:1": "1042",
"body:2": "250",
"button:0": "1042"
}
},
)
data = res.json(){
"id": "7000",
"name": "order_received_v1",
"language": "ar",
"category": "UTILITY",
"status": "PENDING",
"quality": null,
"rejected_reason": null,
"components": [
{
"type": "HEADER",
"format": "TEXT",
"text": "طلبك {{1}}",
"buttons": []
},
{
"type": "BODY",
"format": null,
"text": "استلمنا طلبك رقم {{1}} بقيمة {{2}} ريال، ونبلغك عند شحنه.",
"buttons": []
},
{
"type": "BUTTONS",
"format": null,
"text": null,
"buttons": [
{
"type": "URL",
"text": "تتبع الطلب",
"url": "https://flowers.example/orders/{{1}}",
"phone_number": null
}
]
}
],
"examples": {
"header:1": "1042",
"body:1": "1042",
"body:2": "250",
"button:0": "1042"
},
"placeholders": {
"kind": "positional",
"header": [
"1"
],
"body": [
"1",
"2"
],
"buttons": [
{
"index": 0,
"type": "url"
}
]
},
"managed": false
}{
"error": "invalid_json"
}{
"error": "unauthorized"
}{
"error": "account_not_active"
}{
"error": "not_found"
}{
"error": "template_not_editable",
"status": "PENDING"
}{
"error": "template_category_not_allowed"
}{
"error": "too_many_requests"
}{
"error": "internal_error"
}{
"error": "templates_unavailable"
}Update a template
For a connected app’s key alone: an application’s own key, full access included, answers 403 insufficient_scope, and writes its templates in the console. Replaces a text template’s content on Meta. Send the whole new content: the body of a creation without name and language, which Meta fixed at creation and which are ignored here. Meta reviews the change again. Only an APPROVED, REJECTED or PAUSED template can be edited; anything else answers 409 template_not_editable with a status: the template’s own, META_SAMPLE for one of Meta’s samples, or MEDIA_HEADER for a template that opens with an image or other media, which is edited in the console. An authentication template answers 422 template_category_not_allowed. Answers the template as it stands after the edit.
curl -X PATCH https://tawked.com/v1/whatsapp/templates/7000 \
-H "Authorization: Bearer tk_live_xxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order_received_v1-ar-2" \
-d '{
"category": "UTILITY",
"header": "طلبك {{1}}",
"body": "استلمنا طلبك رقم {{1}} بقيمة {{2}} ريال، ونبلغك عند شحنه.",
"buttons": [
{
"type": "URL",
"text": "تتبع الطلب",
"url": "https://flowers.example/orders/{{1}}"
}
],
"examples": {
"header:1": "1042",
"body:1": "1042",
"body:2": "250",
"button:0": "1042"
}
}'const res = await fetch("https://tawked.com/v1/whatsapp/templates/7000", {
method: "PATCH",
headers: {
Authorization: "Bearer tk_live_xxxxxxxxxxxxxxxxxxxx",
"Content-Type": "application/json",
"Idempotency-Key": "order_received_v1-ar-2",
},
body: JSON.stringify({
"category": "UTILITY",
"header": "طلبك {{1}}",
"body": "استلمنا طلبك رقم {{1}} بقيمة {{2}} ريال، ونبلغك عند شحنه.",
"buttons": [
{
"type": "URL",
"text": "تتبع الطلب",
"url": "https://flowers.example/orders/{{1}}"
}
],
"examples": {
"header:1": "1042",
"body:1": "1042",
"body:2": "250",
"button:0": "1042"
}
}),
});
const data = await res.json();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://tawked.com/v1/whatsapp/templates/{template_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([
'category' => '<string>',
'body' => '<string>',
'header' => '<string>',
'footer' => '<string>',
'buttons' => '<array>',
'examples' => [
]
]),
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;
}import requests
res = requests.patch(
"https://tawked.com/v1/whatsapp/templates/7000",
headers={"Authorization": "Bearer tk_live_xxxxxxxxxxxxxxxxxxxx", "Idempotency-Key": "order_received_v1-ar-2"},
json={
"category": "UTILITY",
"header": "طلبك {{1}}",
"body": "استلمنا طلبك رقم {{1}} بقيمة {{2}} ريال، ونبلغك عند شحنه.",
"buttons": [
{
"type": "URL",
"text": "تتبع الطلب",
"url": "https://flowers.example/orders/{{1}}"
}
],
"examples": {
"header:1": "1042",
"body:1": "1042",
"body:2": "250",
"button:0": "1042"
}
},
)
data = res.json(){
"id": "7000",
"name": "order_received_v1",
"language": "ar",
"category": "UTILITY",
"status": "PENDING",
"quality": null,
"rejected_reason": null,
"components": [
{
"type": "HEADER",
"format": "TEXT",
"text": "طلبك {{1}}",
"buttons": []
},
{
"type": "BODY",
"format": null,
"text": "استلمنا طلبك رقم {{1}} بقيمة {{2}} ريال، ونبلغك عند شحنه.",
"buttons": []
},
{
"type": "BUTTONS",
"format": null,
"text": null,
"buttons": [
{
"type": "URL",
"text": "تتبع الطلب",
"url": "https://flowers.example/orders/{{1}}",
"phone_number": null
}
]
}
],
"examples": {
"header:1": "1042",
"body:1": "1042",
"body:2": "250",
"button:0": "1042"
},
"placeholders": {
"kind": "positional",
"header": [
"1"
],
"body": [
"1",
"2"
],
"buttons": [
{
"index": 0,
"type": "url"
}
]
},
"managed": false
}{
"error": "invalid_json"
}{
"error": "unauthorized"
}{
"error": "account_not_active"
}{
"error": "not_found"
}{
"error": "template_not_editable",
"status": "PENDING"
}{
"error": "template_category_not_allowed"
}{
"error": "too_many_requests"
}{
"error": "internal_error"
}{
"error": "templates_unavailable"
}Authorizations
Authorization: Bearer . An application key (tk_live_, tk_test_) has full access, which covers every product and any product added later, or custom access, chosen when the key is created: one or more of the scopes verify:check, verify:send (includes verify:check), notifications:read, notifications:send (includes notifications:read), notifications:templates (includes notifications:read). No key made on the API keys page holds notifications:templates, full access included: the three template writes answer such a key 403 insufficient_scope. A connected app's key holds it. A call outside the key's access answers 403 insufficient_scope and names the scope it needs in the WWW-Authenticate response header. A partner key (tk_partner_) always has full access. Whatever its access, a key is a server-side secret.
Headers
A 1 to 128 printable-ASCII-character key you generate, scoped to your API key. Replaying it with the same request answers the original 2xx unchanged, with the response header Idempotent-Replayed: true, and runs nothing again; the same key with another request answers 409 idempotency_key_reused, and a request still in flight 409 idempotency_in_progress. A refused request is never stored, so a corrected retry under the same key runs. Keys expire after 24 hours.
Path Parameters
The template's Meta id, as id in GET /v1/whatsapp/templates. One id is one language of a template.
Body
UTILITY. A connected app's key writes utility templates only: MARKETING is refused with 422 template_category_not_allowed. An authentication template is created in the console.
Up to 1024 characters. Placeholders are all named ({{name}}, lowercase) or all numbered ({{1}}, {{2}} in order), never at the very start or end of the text.
A text header: one line, up to 60 characters, no emoji and no asterisk, at most one placeholder.
One line, up to 60 characters, no placeholders.
Up to 10 objects, each with a text of up to 25 characters: { "type": "QUICK_REPLY", "text" }, { "type": "URL", "text", "url" } (https, optionally ending in {{1}}; two at most) or { "type": "PHONE_NUMBER", "text", "phone_number" } (E.164; one at most). Quick replies sit together, before or after the other buttons.
One sample value per placeholder, keyed header:<key>, body:<key> and button:<index>. Required whenever the template has placeholders: Meta reviews with them.