msg91-sdk
This is used to handle msg91 apis such as send otp, sms and sms flow.
How to implement
Install node module package in your project
npm install msg91-sdk --save
Send OTP
use the below code snippet for sending OTP message to the specified mobile number
const sendOtpService = SendOtpService;const sendOtp = "AUTH_KEY" "MESSAGE_TEMPLATE";sendOtpotpLength = 6 // 'XXXXXX'sendOtpotpExpiry = 5 // In minutes const aOptions = mobile: "91988448XXXXX"// Mandatory param along with country dial code otp: "XXXXXX" sendOtp
Verifying OTP message to the specified mobile number
const sendOtpService = SendOtpService;const sendOtp = "AUTH_KEY" "MESSAGE_TEMPLATE"; const aOptions = mobile: "91988448XXXXX"// (*) mobile number of the client otp: "XXXXXX"// (*) OTP received from the client sendOtp
Retry OTP message to the specified mobile number
const sendOtpService = SendOtpService;const sendOtp = "AUTH_KEY" "MESSAGE_TEMPLATE"; const aOptions = mobile: "91988448XXXXX"// (*) mobile number of the client retrytype: "voice"// (optional) ["voice", "text"] "text" -> default one sendOtp
Send SMS
Sending sms to many messages to many users using a below snippet
const sendSmsService = SendSmsService;const sendSms = "AUTH_KEY" "SENDER_ID" "ROUTE_ID";sendSmssenderIdconst mobileNumbers = "988448XXXXX" "988447XXXXX" "988547XXXXX" // (*) mobile number of the client const messages = "Hello all, We welcome you all for msg91-sdk" "This sdk will give you many advantages from others" const countryDialCode = "91" // "91" -> India, "1" -> USA, "44" -> UK, etc sendSms sendSms sendSms
Sending sms with flow
const sendSmsService = SendSmsService;const sendSms = "AUTH_KEY" "SENDER_ID" "ROUTE_ID";sendSmssenderId const mobileNumber = "91988448XXXXX" // mobile number of the userconst templateId = "TEMPLATE_ID" // Template created in msg91 platform //Template Message in msg91 -> Hi All, Welcome you all##COMPANY_NAME## /** * const params = {COMPANY_NAME:"MSG91-SDK"} **/ const params = param_one: "COMPANY_NAME" param_two: "Welcome Message" sendSms
## Utilities
Checking balance of the route type
Buy Me a Coffee
License
Copyright (c) 2020 Naveen Kumar Kuppan Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THESOFTWARE.