Solution for invalid template error code 80 in textlocal sms API

Created at 10-Sep-2021 , By samar

There are two main reasons for error {"errors":[{"code":80,"message":"Invalid template"}],"status":"failure"} on request of textlocal API.

  1. Maybe your template is not approved by textlocal.
  2. Your message is not same as the template message in textlocal and DLT template.

First check template status in textlocal and request for new template if not exist

First login text local https://control.textlocal.in/ and after login visit https://control.textlocal.in/templates/ and check if the status is active or not on the template which you want to use. If status is active on a template item then you can send a message using textlocal API. If there are not any templates available in the templates list click request new template to create the template. Your message should be same as DLT template message except dynamic parameters if you are not created DLT template yet visit here to create DLT template and Business entity registration .

 

 

Message should same as per DLT template and text local template message

Your message in text local template message should be the same as DLT template message except the dynamic parameters in your template. Before passing the message to textlocal API request first check it should be the same as per your textlocal template message except the dynamic parameters. You can see the sample template message in below image.

 

 

Your message should be as per your template message like below.

$message = 'Dear '.$name.' Get 30% off on all our N&K clothing itmes with code '.$code.'. Hurry - offer valid only till the end of this months - N&K clothing';

 

Sample code for API request on textlocal with GET method

// Account details
$apiKey = urlencode('Your_api_key');
// Message details
$numbers = urlencode('91xxxxxxxxxx'); //Mobile number on which you want to send message
$sender = urlencode('SENDER_NAME');
$message = rawurlencode('123456 is OTP for platform verification. Valid for 30 Minutes. Do not Share it with anyone. Contact Us if not initiated by you.');

// Prepare data for POST request
$data = 'apikey=' . $apiKey . '&numbers=' . $numbers . "&sender=" . $sender . "&message=" . $message;
// Send the GET request with cURL
$ch = curl_init('https://api.textlocal.in/send/?' . $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
// Process your response here
echo $response;

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Buy Me A Coffee

Don't forget to share this article! Help us spread the word by clicking the share button below.

We appreciate your support and are committed to providing you valuable and informative content.

We are thankful for your never ending support.