msg91-sms v1.0.1
A small node.js library for msg91 sms api.
For more info visit MSG91
For Text SMS API docs Text SMS
For Voice SMS API docs Voice SMS
Requirements
-
authkey : Login Authentication Key(This key is unique for every user)
-
number : single mobile number (Keep number in international format)
-
numbers : array of mobile numbers (Keep numbers in international format)
-
message : Message Content to send
-
senderid : Receiver will see this as sender's ID
-
route : If your operator supports multiple routes then give one route name. Eg: route=1 for promotional, route=4 for transactional SMS.
-
dialcode : 0 for international, 91 for India, 1 for USA
-
date & time : when you want to schedule the SMS to be sent. Time format will be yyyy-MM-dd & HH:mm:ss
-
senderno : Sender Mobile No
-
duration : Call duration
-
schtimestart : when you want to schedule the SMS to be sent. Time format will be yyyy-MM-dd & HH:mm:ss
-
schtimeend : when you want to schedule the SMS to be sent. Time format will be yyyy-MM-dd & HH:mm:ss
Installation
$ npm install msg91-sms
How to use
Text SMS
Send sms
var msg91=require('msg91-sms');
var authkey='';
var numbers=[];
numbers.push('');
var number='';
var message='';
var senderid='';
var route='';
var dialcode='';
msg91.sendOne(authkey,number,message,senderid,route,dialcode,function(response){
console.log(response);
});
msg91.sendMultiple(authkey,numbers,message,senderid,route,dialcode,function(response){
console.log(response);
});
Send sms with unicode
var msg91=require('msg91-sms');
var authkey='';
var numbers=[];
numbers.push('');
var number='';
var message='';
var senderid='';
var route='';
var dialcode='';
msg91.sendOnewithUnicode(authkey,number,message,senderid,route,dialcode,function(response){
console.log(response);
});
msg91.sendMultiplewithUnicode(authkey,numbers,message,senderid,route,dialcode,function(response){
console.log(response);
});
Send flash message
var msg91=require('msg91-sms');
var authkey='';
var numbers=[];
numbers.push('');
var number='';
var message='';
var senderid='';
var route='';
var dialcode='';
msg91.sendOnewithFlash(authkey,number,message,senderid,route,dialcode,function(response){
console.log(response);
});
msg91.sendMultiplewithFlash(authkey,numbers,message,senderid,route,dialcode,function(response){
console.log(response);
});
Send sms and get json response
var msg91=require('msg91-sms');
var authkey='';
var numbers=[];
numbers.push('');
var number='';
var message='';
var senderid='';
var route='';
var dialcode='';
msg91.sendOneandGetJson(authkey,number,message,senderid,route,dialcode,function(response){
console.log(response);
});
msg91.sendMultipleandGetJson(authkey,numbers,messages,senderid,route,dialcode,function(response){
console.log(response);
});
Schedule sms
var msg91=require('msg91-sms');
var authkey='';
var numbers=[];
numbers.push('');
var number='';
var message='';
var senderid='';
var route='';
var dialcode='';
var date='2015-11-22';
var time='20:19:20';
msg91.scheduleOne(authkey,number,message,senderid,route,dialcode,date,time,function(response){
console.log(response);
});
msg91.scheduleMultiple(authkey,numbers,message,senderid,route,dialcode,date,time,function(response){
console.log(response);
});
Schedule sms with unicode
var msg91=require('msg91-sms');
var authkey='';
var numbers=[];
numbers.push('');
var number='';
var message='';
var senderid='';
var route='';
var dialcode='';
var date='2015-11-22';
var time='20:19:20';
msg91.scheduleOnewithUnicode(authkey,number,message,senderid,route,dialcode,date,time,function(response){
console.log(response);
});
msg91.scheduleMultiplewithUnicode(authkey,numbers,message,senderid,route,dialcode,date,time,function(response){
console.log(response);
});
Send sms to Group
var msg91=require('msg91-sms');
var authkey='';
var message='';
var senderid='';
var groupid='';
msg91.sendtoGroup(authkey,message,senderid,groupid,function(response){
console.log(response);
});
Voice SMS
Send voice sms using draft file
var msg91=require('msg91-sms');
var authkey='';
var numbers=[];
numbers.push('');
var number='';
var route='';
var draft_file_name='';
var campaign='';
var duration='';
var senderno='';
var schtimestart='2015-11-13 09:00:00';
var schtimeend='2015-12-13 23:42:20';
msg91.sendOneVoiceSmsusingDraft(authkey,number,draft_file_name,senderno,route,campaign,duration,schtimestart,schtimeend,function(response){
console.log(response);
});
msg91.sendMVoiceSmsusingDraft(authkey,numbers,draft_file_name,senderno,route,campaign,duration,schtimestart,schtimeend,function(response){
console.log(response);
});
Send voice sms using draft file
var msg91=require('msg91-sms');
var authkey='';
var numbers=[];
numbers.push('');
var number='';
var route='';
var url_file_name='';
var campaign='';
var duration='';
var senderno='';
var schtimestart='2015-11-13 09:00:00';
var schtimeend='2015-12-13 23:42:20';
msg91.sendVoiceSmsusingUrl(authkey,number,url_file_name,senderno,route,campaign,duration,schtimestart,schtimeend,function(response){
console.log(response);
});
msg91.sendMVoiceSmsusingUrl(authkey,numbers,url_file_name,senderno,route,campaign,duration,schtimestart,schtimeend,function(response){
console.log(response);
});
Check balance
var msg91=require('msg91-sms');
var authkey='';
var route='';
msg91.checkBalance(authkey,route,function(response){
console.log(response);
});
License
MIT