Sending OTP SMS with Textlocal

March 4, 2020

My client from India wanted TextLocal as their SMS provider for sending OTP for their mobile API (wished we could use Twilio instead).

Their documentation shows a piece of code like this:

When I tried it, I got this error:

    "errors": [
            "code": 80,
            "message": "Invalid template"
    "status": "failure"

At the time of this writing, their documentation never mentioned anything about error code 80. We figured we have to create a sms template (it's a government regulation in India). So after approval, I have no clue how to use the template.

So we contacted support, which has a slow response. The next day, they gave us this response:

Which is great! They just told us something we already know (from their comprehensive documentation). So we had to figure out ourselves how to use the template, which after some trial-and-error, I finally have successfully sent an OTP.

For anyone out there who will have this kind of problem, the way to use a template is simply to send a sms with a message exactly the same as that in your template. That's it!

So from their documentation:

15. resp =  sendSMS('apikey', '918123456789',
16.     'Jims Autos', 'This is your message')

This is your message should be exactly the same as the approved template.