npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

msg91-v5

v1.1.0

Published

Its msg91 package with latest api's of msg91 including DLT ID i.e v5 for sending otp via sendOtp,sms via flow api,whatsapp and many more.

Downloads

51

Readme

Msg91 NPM version NPM monthly downloads NPM total downloads

Its msg91 package with latest api's of msg91 including DLT ID i.e v5 for sending otp via sendOtp,sms via flow api,whatsapp and many more.

Note: It also supports latest dlt id as parameter in api i.e DLT_TE_ID

Note: Send Sms via flow and whatsapp api is work in progess (WIP)

Msg91-v5 Installation

npm i msg91-v5

Msg91 Integration

Initialization

const msg91 = new (require('msg91-v5'))("Auth Key");

Send SMS via api v2 of msg91

Sending sms to many messages to many mobiles using msg91 v2 api

const msg91 = new (require('msg91-v5'))('Auth Key','Sender id','route id');

const mobileNumbers = ["9194XXXX87XX", "88XXXX67XX", "77XXXX44XX"];
//OR
const mobileNumbers = "9194XXXX87XX,88XXXX67XX,77XXXX44XX";
//OR
const mobileNumbers = "88XXXX67XX";

const messages = ["Your order is placed.Thank You.", "Your order will be shipped tomorrow."]; 
//OR
const messages = "Your order is placed.Thank You.";

const options = {
    mobiles: mobileNumbers,// Mandatory param along with country dial code
    DLT_TE_ID: '540XXXXXXX1057XX', //Mandatory if applicable
    message : messages //Mandatory
}
msg91.sendSMS(options).then(() => {
//Handle success result
}).catch(() => {
//Handle failure result
})

Send OTP


// List of variable with the same name defind in msg sendOtp API
const params = {
    template_id: "VAL", // (Mandatory) You will get it from MSG91 panel
    mobile: "VAL", // (Mandatory)  Keep number in international format with country code  
    authkey: "VAL", // (Optional) Auth Key - if added then it will use this key for the particular api call else it will use default key i.e added when creating msg91 object
    invisible: "VAL", //(Optional) For MOBILE APP only (do not use for Browsers); 1 for ON, 0 for OFF; Mobile Number Automatically Verified if its Mobile Network is ON
    otp: "VAL", //(Optional) OTP you want to send
    invisible: "VAL", // Optional | Description: For MOBILE APP only (do not use for Browsers); 1 for ON, 0 for OFF; Mobile Number Automatically Verified if its Mobile Network is ON
    userip: "VAL", //(Optional) Description: User IP
    email: "VAL", //(Optional) Description: Email ID on which you want to send OTP
    otp_length: "VAL", //(Optional) Description: Number of digits in OTP (default : 4, min : 4, max : 9)
    userip: "VAL", //(Optional) Description: User IP
    otp_expiry: "VAL", //(Optional) Description: Expiry of OTP to verify, in minutes (default : 1 day, min : 1 minute)
    unicode: "VAL", //(Optional) Description: Enter 1 if sending SMS in languages other than English, for english pass 0
}

const args = {
  "Value1": "Param1",
  "Value2": "Param2",
  "Value3": "Param3"
};

msg91.sendOTP(params,args).then(() => {
    //Handle success
}).catch(() => {
    //Handle failure
})

Verify OTP - This can be used to verify the OTP.


const params = {
   mobile: "VAL", // (Mandatory)  Keep number in international format with country code  
   authkey: "VAL", // (Optional) Auth Key - if added then it will use this key for the particular api call else it will use default key i.e added when creating msg91 object
   otp: "VAL", //(Optional) OTP you want to send
   otp_expiry: "VAL" //(Optional) Expiry time to verify an OTP (default time 10 mins). Mandatory to pass if you pass an expiry time in Send OTP API
}

msg91.verifyOTP(params).then(() => {
    //Handle success
}).catch(() => {
    //Handle failure
})

Resend OTP - This can be used to resend the same OTP again to a defined mobile number, resend request can be attempted with both the voice call or text message.

const params = {
   mobile: "VAL", // (Mandatory)  Keep number in international format with country code  
   authkey: "VAL", // (Optional) Auth Key - if added then it will use this key for the particular api call else it will use default key i.e added when creating msg91 object
   retrytype: "VAL", //Description: Default - Voice, For text it should be text
}

msg91.retryOTP(params).then(() => {
    //Handle success
}).catch(() => {
    //Handle failure
})

Checking balance according route type

msg91.getBalance("ROUTE_ID").then(() => {
//Handle success result
}).catch(() => {
//Handle failure result
})