curl --request POST \
--url https://app.thinnest.ai/api/v1/sms/templates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "booking_link",
"body": "Hi {#var#}, thanks for calling Acme Clinic. Book your visit here: {#var#}",
"dltTemplateId": "1207169876543210987",
"category": "service_implicit"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'booking_link',
body: JSON.stringify('Hi {#var#}, thanks for calling Acme Clinic. Book your visit here: {#var#}'),
dltTemplateId: '1207169876543210987',
category: 'service_implicit'
})
};
fetch('https://app.thinnest.ai/api/v1/sms/templates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.thinnest.ai/api/v1/sms/templates"
payload = {
"name": "booking_link",
"body": "Hi {#var#}, thanks for calling Acme Clinic. Book your visit here: {#var#}",
"dltTemplateId": "1207169876543210987",
"category": "service_implicit"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "8d2e4f6a-1b3c-4d5e-9f70-a1b2c3d4e5f6",
"name": "booking_link",
"body": "Hi {#var#}, thanks for calling Acme Clinic. Book your visit here: {#var#}",
"dltTemplateId": "1207169876543210987",
"providerTemplateId": null,
"category": "service_implicit",
"agentMaySend": true
}Add SMS Template
Adds a template exactly as it was approved on your DLT portal, with {#var#} wherever the text changes. Each {#var#} takes at most 30 characters when sent. Promotional templates are not accepted: an agent may only send transactional or service messages. MSG91 and Fast2SMS send by their own template id, so with them providerTemplateId is required. Needs a full key.
curl --request POST \
--url https://app.thinnest.ai/api/v1/sms/templates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "booking_link",
"body": "Hi {#var#}, thanks for calling Acme Clinic. Book your visit here: {#var#}",
"dltTemplateId": "1207169876543210987",
"category": "service_implicit"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'booking_link',
body: JSON.stringify('Hi {#var#}, thanks for calling Acme Clinic. Book your visit here: {#var#}'),
dltTemplateId: '1207169876543210987',
category: 'service_implicit'
})
};
fetch('https://app.thinnest.ai/api/v1/sms/templates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.thinnest.ai/api/v1/sms/templates"
payload = {
"name": "booking_link",
"body": "Hi {#var#}, thanks for calling Acme Clinic. Book your visit here: {#var#}",
"dltTemplateId": "1207169876543210987",
"category": "service_implicit"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "8d2e4f6a-1b3c-4d5e-9f70-a1b2c3d4e5f6",
"name": "booking_link",
"body": "Hi {#var#}, thanks for calling Acme Clinic. Book your visit here: {#var#}",
"dltTemplateId": "1207169876543210987",
"providerTemplateId": null,
"category": "service_implicit",
"agentMaySend": true
}Authorizations
Your API key (ta_live_…) from Settings → API keys, sent as Authorization: Bearer <key>. Keep it on a server: it can message every customer you have. A key is full, build or read-only; a request its level does not allow is refused with 403.
Headers
Developers only: the customer workspace this request acts in — its org_… id from POST /customers. Leave it out to act in your own workspace. Refused with 404 (Workspace not found.) when the id is unknown, is not one of your customers, or is not an org_… id; 410 when that customer was deleted (restore it with POST /customers/{id}/restore until it is erased); 403 when the key belongs to one customer workspace (it cannot act as another); 400 when your workspace is not a developer workspace. /customers/* and GET /customers/usage are your own workspace's and refuse the header with 400: call them without it.
"org_3fKq9TzQ1mN8vB2xR7cLpA"
Body
Response
Added.
Your name for it; the agent sees it.
As approved on DLT, with {#var#} blanks.
MSG91's template id or Fast2SMS's message id; null with other providers.
transactional, service_implicit, service_explicit Whether an agent may send this template during a call or chat (its send_sms tool). The after-call message is chosen per agent and is not affected.