Including sample media in your template submission allows Meta to preview exactly how your template will look to end-users. This visual reference improves the likelihood of template approval by helping Meta reviewers understand the context and quality of the content, ensuring compliance with guidelines.
This requirement is similar to the sample media upload flow in WhatsApp Manager’s Create Template dashboard, where you preview media assets or text values before submission.
How to Use the Upload Sample API
Step-by-Step Guide
This API process replicates the familiar dashboard experience, allowing developers to streamline media template submissions programmatically while adhering to Meta’s guidelines.
'https://<api_key>:<api_token>@<subdomain>/v2/accounts/<accountsid>Exotel/templates/sample?file_length=<file-size-in-bytes>&file_type=<file-type>
<your_api_key>
and <your_api_token>
with the API key and token created by you.<your_sid>
with your “Account sid”<subdomain>
with the region of your account
<your_api_key>
, <your_api_token>
and <your_sid>
are available in the API settings page of your Exotel Dashboard
Listed below are the parameters for the POST API.
Parameter Name |
Type |
Mandatory/ Optional |
Value/ Description |
file_length |
String |
Mandatory |
Size of the file in bytes |
file_type |
String |
Mandatory |
Type of the file -
|
POST DATA
Binary data of the file
HTTPResponseObject
Parameter Name |
Type |
Mandatory/ Optional |
Value/ Description |
request_id |
String |
Mandatory |
ID of the request |
method |
String |
Mandatory |
HTTP Request Method |
http_code |
Integer |
Mandatory |
HTTP Code of the request |
response |
ResponseObject |
Mandatory |
Response for the request |
ResponseObject
Parameter Name |
Type |
Mandatory/ Optional |
Values/ Description |
|
ChannelResponseObject |
Optional |
Channel Response for Whatsapp |
ChannelResponseObject
Parameter Name |
Type |
Mandatory/ Optional |
Values/ Description |
file_handle |
[]FileHandleResponseObject |
Mandatory |
Message Response |
FileHandleResponseObject
Parameter Name |
Type |
Mandatory/ Optional |
Value/ Description |
id |
String |
Mandatory |
Id of the file_handle |
Please refer to our working Postman collection to access the API here - Template Management - Upload Sample
curl --location 'https://:@api.exotel.com/v2/accounts//templates/sample?file_length=1024&file_type=png' \ --header 'Content-Type: image/png' \ --data '@/home/exotel/Pictures/leaf.png'
{ "request_id": "232e2865b3d74516b1d3fcb319493260", "method": "POST", "http_code": 200, "response": { "whatsapp": { "file_handle": [ { "code": 200, "error_data": null, "status": "success", "data": { "id": "4::cG5n:ARbMfw_qdKVRCAscOITqcGs_hbOmQO-2iS7aWOmJRPsMNNAfgdQPt1n5iNnELKQ:e:1731231031:3157993617821787:XXXXXX:XXXXXXXX" } } ] } } }
Once you successfully generate the Media ID, copy and use it in the Create Template API under the header_handle parameter.