Upload a sample image for a template's IMAGE header (multipart `image`, a JPG or PNG of at most 5 MB); answers its `path`, sent as `header_sample` to whatsapp.templates.create or a draft's variant.
curl --request POST \
--url https://tawked.com/v1/applications/{application}/whatsapp/template-samples \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form image=@example-fileconst form = new FormData();
form.append('image', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://tawked.com/v1/applications/{application}/whatsapp/template-samples', 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://tawked.com/v1/applications/{application}/whatsapp/template-samples",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}import requests
url = "https://tawked.com/v1/applications/{application}/whatsapp/template-samples"
files = { "image": ("example-file", open("example-file", "rb")) }
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, files=files, headers=headers)
print(response.text){
"data": {}
}{
"error": "<string>",
"message": "<string>",
"fields": {},
"needs": "<string>",
"next": "<string>",
"did_you_mean": [
{}
],
"human_action": {
"reason": "connect_whatsapp",
"url": "<string>",
"say": "<string>",
"then": "<string>"
},
"approval": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "pending",
"operation": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}
}{
"error": "<string>",
"message": "<string>",
"fields": {},
"needs": "<string>",
"next": "<string>",
"did_you_mean": [
{}
],
"human_action": {
"reason": "connect_whatsapp",
"url": "<string>",
"say": "<string>",
"then": "<string>"
},
"approval": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "pending",
"operation": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}
}{
"error": "<string>",
"message": "<string>",
"fields": {},
"needs": "<string>",
"next": "<string>",
"did_you_mean": [
{}
],
"human_action": {
"reason": "connect_whatsapp",
"url": "<string>",
"say": "<string>",
"then": "<string>"
},
"approval": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "pending",
"operation": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}
}{
"error": "<string>",
"message": "<string>",
"fields": {},
"needs": "<string>",
"next": "<string>",
"did_you_mean": [
{}
],
"human_action": {
"reason": "connect_whatsapp",
"url": "<string>",
"say": "<string>",
"then": "<string>"
},
"approval": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "pending",
"operation": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}
}{
"error": "<string>",
"message": "<string>",
"fields": {},
"needs": "<string>",
"next": "<string>",
"did_you_mean": [
{}
],
"human_action": {
"reason": "connect_whatsapp",
"url": "<string>",
"say": "<string>",
"then": "<string>"
},
"approval": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "pending",
"operation": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}
}{
"error": "<string>",
"message": "<string>",
"fields": {},
"needs": "<string>",
"next": "<string>",
"did_you_mean": [
{}
],
"human_action": {
"reason": "connect_whatsapp",
"url": "<string>",
"say": "<string>",
"then": "<string>"
},
"approval": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "pending",
"operation": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}
}whatsapp
whatsapp.template_samples.create
POST
/
v1
/
applications
/
{application}
/
whatsapp
/
template-samples
Upload a sample image for a template's IMAGE header (multipart `image`, a JPG or PNG of at most 5 MB); answers its `path`, sent as `header_sample` to whatsapp.templates.create or a draft's variant.
curl --request POST \
--url https://tawked.com/v1/applications/{application}/whatsapp/template-samples \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form image=@example-fileconst form = new FormData();
form.append('image', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://tawked.com/v1/applications/{application}/whatsapp/template-samples', 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://tawked.com/v1/applications/{application}/whatsapp/template-samples",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}import requests
url = "https://tawked.com/v1/applications/{application}/whatsapp/template-samples"
files = { "image": ("example-file", open("example-file", "rb")) }
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, files=files, headers=headers)
print(response.text){
"data": {}
}{
"error": "<string>",
"message": "<string>",
"fields": {},
"needs": "<string>",
"next": "<string>",
"did_you_mean": [
{}
],
"human_action": {
"reason": "connect_whatsapp",
"url": "<string>",
"say": "<string>",
"then": "<string>"
},
"approval": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "pending",
"operation": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}
}{
"error": "<string>",
"message": "<string>",
"fields": {},
"needs": "<string>",
"next": "<string>",
"did_you_mean": [
{}
],
"human_action": {
"reason": "connect_whatsapp",
"url": "<string>",
"say": "<string>",
"then": "<string>"
},
"approval": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "pending",
"operation": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}
}{
"error": "<string>",
"message": "<string>",
"fields": {},
"needs": "<string>",
"next": "<string>",
"did_you_mean": [
{}
],
"human_action": {
"reason": "connect_whatsapp",
"url": "<string>",
"say": "<string>",
"then": "<string>"
},
"approval": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "pending",
"operation": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}
}{
"error": "<string>",
"message": "<string>",
"fields": {},
"needs": "<string>",
"next": "<string>",
"did_you_mean": [
{}
],
"human_action": {
"reason": "connect_whatsapp",
"url": "<string>",
"say": "<string>",
"then": "<string>"
},
"approval": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "pending",
"operation": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}
}{
"error": "<string>",
"message": "<string>",
"fields": {},
"needs": "<string>",
"next": "<string>",
"did_you_mean": [
{}
],
"human_action": {
"reason": "connect_whatsapp",
"url": "<string>",
"say": "<string>",
"then": "<string>"
},
"approval": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "pending",
"operation": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}
}{
"error": "<string>",
"message": "<string>",
"fields": {},
"needs": "<string>",
"next": "<string>",
"did_you_mean": [
{}
],
"human_action": {
"reason": "connect_whatsapp",
"url": "<string>",
"say": "<string>",
"then": "<string>"
},
"approval": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "pending",
"operation": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}
}Authorizations
An account token from Settings › Account API in the Tawked console: Authorization: Bearer tk_acct_…
Headers
One per intended change (1 to 128 printable ASCII characters): a retry with the same key and the same request answers the stored 2xx with Idempotent-Replayed: true, for 24 hours. A 428 approval_required is never stored: send the approved request again with the same key or none. An answer that carried a secret shown once is never kept: its replay answers 409 idempotency_secret_not_replayable with the id of what it made.
Required string length:
1 - 128Path Parameters
An application's id (a UUID); list them with applications.applications.list.
Pattern:
^(?:[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12})$Body
multipart/form-data
Maximum string length:
5120Response
Created.