How can I use TinyURL to comply with the TRAI whitelisting rules for sending SMS that contains URLs
The Telecom Regulatory Authority of India (TRAI) published new rules for usage of URLs in SMS messages on August 20, 2024 which came into effect on October 1, 2024. This regulation requires senders to add their URLs to TRAI's whitelist of URLs.
A typical TinyURL link uses the format of tinyurl.com/example where the "example" part is dynamic and changing for each recipient you send an SMS message to. TRAI, however, requires the sender to make the first part of the path, which they call the header, static so that it can be registered on the whitelist.
We do not directly support this format for URL shortening, but with our path expansion feature, we can accomplish their required format.
TinyURL path expansion explained
When a TinyURL link has an extra directory or directories added to the path of the URL, TinyURL will transform the destination link to include that added path.
As an example, a TinyURL link like https://tinyurl.com/example which has a destination that goes to https://example.com can have another directory added to the path such as https://tinyurl.com/example/123abc which will redirect to https://example.com/123abc
Creating the TRAI header with your branded domain
To set up your branded domain with the header, you would create a TinyURL link using your branded domain and then enter the header, which is usually your registered TRAI sender ID, as the alias, and point it to just your branded domain as the destination URL.
Let's take the branded domain mybranded.link to use as an example. Using this domain, we would create the TinyURL link of https://mybranded.link/HEADER, where HEADER is your sender ID, and enter in the destination URL of https://mybranded.link
This will result in all links under this domain working with or without the "HEADER" (the sender ID, or header as they call it) in it, so that a newly created TinyURL link will work as https://mybranded.link/example or as https://mybranded.link/HEADER/example and take you to the same destination URL.
Our API will not output new TinyURL links with the header included, so your code will have to add it into the resulting TinyURL link that is returned.
Working with the 30 character limit of variables in message templates
When sending commercial SMS in India, TRAI requires you to use message templates for most of the messages you send. Unfourtunately, the additional seven characters they require you to add as a result of needing to include your six character sender ID and add another slash to the URL makes the URL longer and more difficult to use as a variable. With eight characters for the https://, at least three for the top level domain like .in or .com, one for the slash following the domain, and seven for the sender ID, we only have 11 more characters to work with for the random alias and domain name.
While choosing a short domain can help solve this problem, it is best practice to use a domain that is on brand so your recipients know it's from you and is a message they can trust. Normally, you can get away without including the https:// part of the URL if it is a .com or .in domain as all messaging apps will turn them into clickable links, but the TRAI regulations require you to use https:// in your URLs, leaving us without many options.
The only solution then to have an on brand domain and stay within the limits when shortening a URL is to have only the dynamic part of the URL as a the value of the variable. In your message template, you would have https://mybranded.link/HEADER/{#var#} and then you would pull out the alias from the generated TinyURL link, such as "example" like we used above, and submit that as the value for the variable when sending your message to result in the URL being https://mybranded.link/HEADER/example