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:
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 :
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.
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.
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);
});
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.
Do you want to access your webcamera remotely? Then this article is for you.
Calendar Picker / Appointment Setter JS CSS Library. Inspired by Calendly.
Create a local file sharing server with realtime sync feature using Socket IO.
Most beautiful Navbars designed with tailwind css. Fully responsive templates.
Most beautiful dashboards designed with bootstrap 5. Inspired mostly from dribble and other sources.
Most commonly used HTML email templates. Welcome email, sign up, password reset etc.
Checkout our most downloaded payment page ui designed with bootstrap.
Detect user's inactivity and auto logout after certain timeout using various JS features.
Keep the user engaged and gain recurring website traffic. Includes templates.
How to get a user's location using Javascript and other techniques available today.
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.