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>',
'header_format' => '<string>',
'header_sample_url' => '<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
}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 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. A template that opens with an image or a document is edited like a text one, header_format included (without it the edit answers 409 template_not_editable with MEDIA_HEADER, so an edit written for text never drops the file), and without header_sample_url the sample Meta holds is kept. 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 a video or a location, which is edited in the console, or with an image or a document when the edit leaves out header_format. 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>',
'header_format' => '<string>',
'header_sample_url' => '<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
}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), email:read, email:send (includes email:read), email:manage (includes email:send), webhooks:manage, email:inbound, notifications:templates (includes notifications:read), chat:menus, chat:attendant. 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. Nor chat:menus: the five conversation menu operations answer such a key 403 insufficient_scope, and a connected app's key holds it once the client approved it. Nor chat:attendant: the five auto-attendant operations answer such a key 403 insufficient_scope too, and a connected app's key holds it once the client approved it. email:manage and webhooks:manage are held only by a key someone chose them for: a full-access key, old or new, never holds them. email:inbound, which reads, deletes and forwards received e-mail, is opt-in on every key, full access included: a key holds it only when it was turned on when the key was created. 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
Body
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 placeholder's name is at most 20 characters ({{start_date}}, not {{subscription_start_date}}): Meta approves a longer one but refuses every message from it, so it is refused as placeholderName.
What the template opens with: TEXT (the default, for a text header or none), IMAGE or DOCUMENT (a PDF: an invoice, a contract, an attendance sheet). Each message to an IMAGE or DOCUMENT template carries its own file in header.image or header.document when it is sent. Any other value answers 400 invalid_request with headerFormatInvalid. On an edit of a template that opens with an image or a document, send it again: an edit without it answers 409 template_not_editable with MEDIA_HEADER, so an edit written for text never drops the file; TEXT makes it a text template.
An https link to the sample Meta reviews the template with: a PDF for DOCUMENT, a JPG or PNG for IMAGE, at most 5 MB (Tawked's limit). Tawked downloads it once from a public address (at most 3 redirects, 8 seconds) and uploads it to Meta; the sample is for the review only. Required on a creation with IMAGE or DOCUMENT; optional on an edit, which keeps the sample Meta already holds when it is left out. A refusal answers 400 invalid_request naming header_sample_url, with headerSampleMissing (no link for an IMAGE or DOCUMENT creation), headerSampleUnreachable (not https, a private address, an error status, a timeout), headerSampleInvalid (not a PDF for DOCUMENT, not a JPG or PNG for IMAGE) or headerSampleTooLarge (over 5 MB).
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.