Send SMS using DLT (India)

Article


author small image Siva Kishore G
Posted : 18 Nov 2023
Modified : 19 Nov 2023
Expert Developers
Send SMS using Arirtel DLT and Node JS

Introduction to DLT & TRAI

Telecom Regulatory Authority of India (TRAI) introduced a DLT platform for SMS regulation to curb the issue of unsolicited commercial communication (spam) and to ensure that telemarketers comply with regulations. This DLT platform acts as a registry where businesses and telemarketers need to register and authenticate their SMS traffic.

Some of the major DLT platforms adopted in India for SMS compliance include:

  • Bharti Airtel: Airtel also has its DLT platform for SMS regulation, and businesses need to register on Airtel DLT to comply with the regulations.
  • Vodafone Idea Ltd (now Vi): The company has implemented a DLT platform for SMS regulation, and businesses need to register on their platform.
  • Reliance Jio: Jio also implemented its DLT platform for SMS compliance. Businesses and telemarketers need to register on the Jio DLT platform.

Setting up DLT with Airtel

Prior to the setup process, you face two options. Firstly, you can set up as a telemarketer, allowing you to send SMS on behalf of your clients. Secondly, you can opt for the enterprise setup, enabling you to send messages directly to your clients, with attention to the specific naming conventions. Rules for setting up as enterprise are as follows :

  • Make sure you have all your business documents such as Business Certificate, Tax certificate Address Proof and header authorization document (sample provided by airtel).
  • Approved DLT
  • Upon successful approval of the business, a registration fee of 5900 (as of the time of writing this article) is required. Subsequently, you can proceed to create header IDs and templates.
  • DLt Purchase
  • The header ID, the ID from which the user receives messages, must align phonetically with your business name; otherwise, it will not receive approval. Header ID has to be 3-6 characters long.
  • Authorized Headers for DLT
  • The creation of templates is possible only after supplying a brand name and obtaining successful approval for header IDs. These templates can consist of up to 2000 characters, allowing for non-consecutive variables. Typically, a minimum of 60% static content is required.
  • Authorized Templates for DLT
  • In every template, the business name or approved brand name must appear.
  • Strictly adhere to the rules to ensure timely approvals. Any usage of spam words or phishing messages will lead to immediate disapproval and could result in the suspension of the account.

Setting up MSG91

Having successfully set up the DLT, proceed to create an account in MSG91, from which you will receive an API and a key for sending SMS programmatically. Note that approvals for templates are also a prerequisite in their process.

MSG91 Header Registration MSG91 Template Registration MSG91 Verified Template

On this platform, it is essential to register the approved Header ID and generate templates utilizing sanctioned DLT template IDs. If your DLT template contains multiple variables, replicate the template content in MSG91, substituting and incrementing with variables like "##var1##," "##var2##," "##var3##," etc. These can subsequently be employed in the API to target the corresponding variables accurately.

Send SMS using API

After purchasing the SMS pack, you can use the API key to send sms to the target mobile number. Here is the Node JS implementation.

// Using Fetch
function msg91() {
    const options = {
        method: 'POST',
        headers: {
            accept: 'application/json',
            'content-type': 'application/json',
            authkey: 'API_KEY'
        },
        body: JSON.stringify({
            template_id: 'MSG91_TEMPLATE_ID',
            short_url: '0',
            recipients: [{ 
                mobiles: 'MOBILE_NUMBER_WITH_COUNTRY_CODE', //919001231234
                var1: 'VARIABLE 1', 
                var2: 'VARIABLE 2' 
            }]
        })
    };
    fetch('https://control.msg91.com/api/v5/flow/', options)
        .then(response => response.json())
        .then(response => console.log(response))
        .catch(err => console.error(err));
}
// Using Axois
const apiKey = 'API_KEY';
const apiUrl = 'https://control.msg91.com/api/v5/flow/';

const requestData = {
    template_id: 'MSG91_TEMPLATE_ID',
    short_url: '0',
    recipients: [{ mobiles: `91${num}`, var1: 'VARIABLE' , var2: 'VARIABLE'}]
};

axios.post(apiUrl, requestData, {
    headers: {
    'Content-Type': 'application/json',
    'authkey': apiKey
    }
})
.then(response => {
    console.log(response.data);
})
.catch(error => {
    console.error(error);
});

Conclusion

This procedure has grown considerably more extensive, a departure from the situation a few years ago. With the surge in phishing and scam texts, the Indian Government and carriers have implemented stringent measures to counteract such attempts. Whether for the better or not, setting up this platform has become a genuine challenge. It took me a full week to complete the setup, obtain approvals, and integrate it into my project. I wanted to share my experience to inform you of the process, as it would have been more convenient if there had been an article like this available when I started.



Post a comment

I promise, I keep it clean *

Comments

Alert SVG Cookie Consent

This website uses cookies and similar technologies, to enhance your browsing experience and provide personalized recommendations. By continuing to use our website, you agree to our Privacy policy.