Use exactly one header type that matches the approved template.
Case 1: Text only
Template without a header.
curl -X POST "https://sparklebot.in/api/v1/YOUR_TENANT/messages/template" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"phone_number": "91XXXXXXXXXX",
"template_name": "order_confirmation",
"template_language": "en",
"field_1": "Priya",
"field_2": "ORD58213"
}'
curl -X POST "https://sparklebot.in/api/v1/YOUR_TENANT/messages/template" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-F "phone_number=91XXXXXXXXXX" \
-F "template_name=order_confirmation" \
-F "template_language=en" \
-F "field_1=Priya" \
-F "field_2=ORD58213"
<?php
$payload = <<<'JSON'
{
"phone_number": "91XXXXXXXXXX",
"template_name": "order_confirmation",
"template_language": "en",
"field_1": "Priya",
"field_2": "ORD58213"
}
JSON;
$ch = curl_init('https://sparklebot.in/api/v1/YOUR_TENANT/messages/template');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $payload,
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_TOKEN', 'Content-Type: application/json'],
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
]);
$response = curl_exec($ch);
curl_close($ch);
print_r(json_decode($response, true));
import requests
payload = {
"phone_number": "91XXXXXXXXXX",
"template_name": "order_confirmation",
"template_language": "en",
"field_1": "Priya",
"field_2": "ORD58213"
}
r = requests.post("https://sparklebot.in/api/v1/YOUR_TENANT/messages/template",
headers={"Authorization": "Bearer YOUR_API_TOKEN", "Content-Type": "application/json"},
json=payload, timeout=30)
print(r.status_code, r.json())
const res = await fetch("https://sparklebot.in/api/v1/YOUR_TENANT/messages/template", {
method: "POST",
headers: { "Authorization": "Bearer YOUR_API_TOKEN", "Content-Type": "application/json" },
body: JSON.stringify({
"phone_number": "91XXXXXXXXXX",
"template_name": "order_confirmation",
"template_language": "en",
"field_1": "Priya",
"field_2": "ORD58213"
})
});
console.log(res.status, await res.json());
using System.Net.Http;
using System.Text;
using var http = new HttpClient();
http.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", "Bearer YOUR_API_TOKEN");
var body = new StringContent(@"{""phone_number"": ""91XXXXXXXXXX"", ""template_name"": ""order_confirmation"", ""template_language"": ""en"", ""field_1"": ""Priya"", ""field_2"": ""ORD58213""}", Encoding.UTF8, "application/json");
var res = await http.PostAsync("https://sparklebot.in/api/v1/YOUR_TENANT/messages/template", body);
Console.WriteLine(await res.Content.ReadAsStringAsync());
Case 2: Image header
Template with an image header.
curl -X POST "https://sparklebot.in/api/v1/YOUR_TENANT/messages/template" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"phone_number": "91XXXXXXXXXX",
"template_name": "festive_offer",
"template_language": "en",
"field_1": "Priya",
"header_image_url": "https://yourdomain.com/images/offer.jpg"
}'
curl -X POST "https://sparklebot.in/api/v1/YOUR_TENANT/messages/template" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-F "phone_number=91XXXXXXXXXX" \
-F "template_name=festive_offer" \
-F "template_language=en" \
-F "field_1=Priya" \
-F "header_image_file=@offer.jpg"
<?php
$payload = <<<'JSON'
{
"phone_number": "91XXXXXXXXXX",
"template_name": "festive_offer",
"template_language": "en",
"field_1": "Priya",
"header_image_url": "https://yourdomain.com/images/offer.jpg"
}
JSON;
$ch = curl_init('https://sparklebot.in/api/v1/YOUR_TENANT/messages/template');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $payload,
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_TOKEN', 'Content-Type: application/json'],
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
]);
$response = curl_exec($ch);
curl_close($ch);
print_r(json_decode($response, true));
import requests
payload = {
"phone_number": "91XXXXXXXXXX",
"template_name": "festive_offer",
"template_language": "en",
"field_1": "Priya",
"header_image_url": "https://yourdomain.com/images/offer.jpg"
}
r = requests.post("https://sparklebot.in/api/v1/YOUR_TENANT/messages/template",
headers={"Authorization": "Bearer YOUR_API_TOKEN", "Content-Type": "application/json"},
json=payload, timeout=30)
print(r.status_code, r.json())
const res = await fetch("https://sparklebot.in/api/v1/YOUR_TENANT/messages/template", {
method: "POST",
headers: { "Authorization": "Bearer YOUR_API_TOKEN", "Content-Type": "application/json" },
body: JSON.stringify({
"phone_number": "91XXXXXXXXXX",
"template_name": "festive_offer",
"template_language": "en",
"field_1": "Priya",
"header_image_url": "https://yourdomain.com/images/offer.jpg"
})
});
console.log(res.status, await res.json());
using System.Net.Http;
using System.Text;
using var http = new HttpClient();
http.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", "Bearer YOUR_API_TOKEN");
var body = new StringContent(@"{""phone_number"": ""91XXXXXXXXXX"", ""template_name"": ""festive_offer"", ""template_language"": ""en"", ""field_1"": ""Priya"", ""header_image_url"": ""https://yourdomain.com/images/offer.jpg""}", Encoding.UTF8, "application/json");
var res = await http.PostAsync("https://sparklebot.in/api/v1/YOUR_TENANT/messages/template", body);
Console.WriteLine(await res.Content.ReadAsStringAsync());
Case 3: Document header
Template with a PDF or document header.
curl -X POST "https://sparklebot.in/api/v1/YOUR_TENANT/messages/template" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"phone_number": "91XXXXXXXXXX",
"template_name": "invoice_share",
"template_language": "en",
"field_1": "INV-1043",
"header_document_url": "https://yourdomain.com/docs/invoice-1043.pdf"
}'
curl -X POST "https://sparklebot.in/api/v1/YOUR_TENANT/messages/template" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-F "phone_number=91XXXXXXXXXX" \
-F "template_name=invoice_share" \
-F "template_language=en" \
-F "field_1=INV-1043" \
-F "header_document_file=@invoice-1043.pdf"
<?php
$payload = <<<'JSON'
{
"phone_number": "91XXXXXXXXXX",
"template_name": "invoice_share",
"template_language": "en",
"field_1": "INV-1043",
"header_document_url": "https://yourdomain.com/docs/invoice-1043.pdf"
}
JSON;
$ch = curl_init('https://sparklebot.in/api/v1/YOUR_TENANT/messages/template');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $payload,
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_TOKEN', 'Content-Type: application/json'],
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
]);
$response = curl_exec($ch);
curl_close($ch);
print_r(json_decode($response, true));
import requests
payload = {
"phone_number": "91XXXXXXXXXX",
"template_name": "invoice_share",
"template_language": "en",
"field_1": "INV-1043",
"header_document_url": "https://yourdomain.com/docs/invoice-1043.pdf"
}
r = requests.post("https://sparklebot.in/api/v1/YOUR_TENANT/messages/template",
headers={"Authorization": "Bearer YOUR_API_TOKEN", "Content-Type": "application/json"},
json=payload, timeout=30)
print(r.status_code, r.json())
const res = await fetch("https://sparklebot.in/api/v1/YOUR_TENANT/messages/template", {
method: "POST",
headers: { "Authorization": "Bearer YOUR_API_TOKEN", "Content-Type": "application/json" },
body: JSON.stringify({
"phone_number": "91XXXXXXXXXX",
"template_name": "invoice_share",
"template_language": "en",
"field_1": "INV-1043",
"header_document_url": "https://yourdomain.com/docs/invoice-1043.pdf"
})
});
console.log(res.status, await res.json());
using System.Net.Http;
using System.Text;
using var http = new HttpClient();
http.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", "Bearer YOUR_API_TOKEN");
var body = new StringContent(@"{""phone_number"": ""91XXXXXXXXXX"", ""template_name"": ""invoice_share"", ""template_language"": ""en"", ""field_1"": ""INV-1043"", ""header_document_url"": ""https://yourdomain.com/docs/invoice-1043.pdf""}", Encoding.UTF8, "application/json");
var res = await http.PostAsync("https://sparklebot.in/api/v1/YOUR_TENANT/messages/template", body);
Console.WriteLine(await res.Content.ReadAsStringAsync());
Case 4: Video header
Template with a video header.
curl -X POST "https://sparklebot.in/api/v1/YOUR_TENANT/messages/template" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"phone_number": "91XXXXXXXXXX",
"template_name": "product_demo",
"template_language": "en",
"field_1": "Priya",
"header_video_url": "https://yourdomain.com/videos/demo.mp4"
}'
curl -X POST "https://sparklebot.in/api/v1/YOUR_TENANT/messages/template" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-F "phone_number=91XXXXXXXXXX" \
-F "template_name=product_demo" \
-F "template_language=en" \
-F "field_1=Priya" \
-F "header_video_file=@demo.mp4"
<?php
$payload = <<<'JSON'
{
"phone_number": "91XXXXXXXXXX",
"template_name": "product_demo",
"template_language": "en",
"field_1": "Priya",
"header_video_url": "https://yourdomain.com/videos/demo.mp4"
}
JSON;
$ch = curl_init('https://sparklebot.in/api/v1/YOUR_TENANT/messages/template');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $payload,
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_TOKEN', 'Content-Type: application/json'],
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
]);
$response = curl_exec($ch);
curl_close($ch);
print_r(json_decode($response, true));
import requests
payload = {
"phone_number": "91XXXXXXXXXX",
"template_name": "product_demo",
"template_language": "en",
"field_1": "Priya",
"header_video_url": "https://yourdomain.com/videos/demo.mp4"
}
r = requests.post("https://sparklebot.in/api/v1/YOUR_TENANT/messages/template",
headers={"Authorization": "Bearer YOUR_API_TOKEN", "Content-Type": "application/json"},
json=payload, timeout=30)
print(r.status_code, r.json())
const res = await fetch("https://sparklebot.in/api/v1/YOUR_TENANT/messages/template", {
method: "POST",
headers: { "Authorization": "Bearer YOUR_API_TOKEN", "Content-Type": "application/json" },
body: JSON.stringify({
"phone_number": "91XXXXXXXXXX",
"template_name": "product_demo",
"template_language": "en",
"field_1": "Priya",
"header_video_url": "https://yourdomain.com/videos/demo.mp4"
})
});
console.log(res.status, await res.json());
using System.Net.Http;
using System.Text;
using var http = new HttpClient();
http.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", "Bearer YOUR_API_TOKEN");
var body = new StringContent(@"{""phone_number"": ""91XXXXXXXXXX"", ""template_name"": ""product_demo"", ""template_language"": ""en"", ""field_1"": ""Priya"", ""header_video_url"": ""https://yourdomain.com/videos/demo.mp4""}", Encoding.UTF8, "application/json");
var res = await http.PostAsync("https://sparklebot.in/api/v1/YOUR_TENANT/messages/template", body);
Console.WriteLine(await res.Content.ReadAsStringAsync());
Case 5: Text header variable
Template whose text header contains a variable.
curl -X POST "https://sparklebot.in/api/v1/YOUR_TENANT/messages/template" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"phone_number": "91XXXXXXXXXX",
"template_name": "account_alert",
"template_language": "en",
"field_1": "Priya",
"header_field_1": "Security alert"
}'
curl -X POST "https://sparklebot.in/api/v1/YOUR_TENANT/messages/template" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-F "phone_number=91XXXXXXXXXX" \
-F "template_name=account_alert" \
-F "template_language=en" \
-F "field_1=Priya" \
-F "header_field_1=Security alert"
<?php
$payload = <<<'JSON'
{
"phone_number": "91XXXXXXXXXX",
"template_name": "account_alert",
"template_language": "en",
"field_1": "Priya",
"header_field_1": "Security alert"
}
JSON;
$ch = curl_init('https://sparklebot.in/api/v1/YOUR_TENANT/messages/template');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $payload,
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_TOKEN', 'Content-Type: application/json'],
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
]);
$response = curl_exec($ch);
curl_close($ch);
print_r(json_decode($response, true));
import requests
payload = {
"phone_number": "91XXXXXXXXXX",
"template_name": "account_alert",
"template_language": "en",
"field_1": "Priya",
"header_field_1": "Security alert"
}
r = requests.post("https://sparklebot.in/api/v1/YOUR_TENANT/messages/template",
headers={"Authorization": "Bearer YOUR_API_TOKEN", "Content-Type": "application/json"},
json=payload, timeout=30)
print(r.status_code, r.json())
const res = await fetch("https://sparklebot.in/api/v1/YOUR_TENANT/messages/template", {
method: "POST",
headers: { "Authorization": "Bearer YOUR_API_TOKEN", "Content-Type": "application/json" },
body: JSON.stringify({
"phone_number": "91XXXXXXXXXX",
"template_name": "account_alert",
"template_language": "en",
"field_1": "Priya",
"header_field_1": "Security alert"
})
});
console.log(res.status, await res.json());
using System.Net.Http;
using System.Text;
using var http = new HttpClient();
http.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", "Bearer YOUR_API_TOKEN");
var body = new StringContent(@"{""phone_number"": ""91XXXXXXXXXX"", ""template_name"": ""account_alert"", ""template_language"": ""en"", ""field_1"": ""Priya"", ""header_field_1"": ""Security alert""}", Encoding.UTF8, "application/json");
var res = await http.PostAsync("https://sparklebot.in/api/v1/YOUR_TENANT/messages/template", body);
Console.WriteLine(await res.Content.ReadAsStringAsync());