Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
This is used to handle msg91 apis such as send otp, sms and sms flow.
Install node module package in your project
npm install msg91-sdk --save
use the below code snippet for sending OTP message to the specified mobile number
const sendOtpService = require('msg91-sdk').SendOtpService;
const sendOtp = new sendOtpService("AUTH_KEY", "MESSAGE_TEMPLATE");
sendOtp.otpLength = 6 // 'XXXXXX'
sendOtp.otpExpiry = 5 // In minutes
const aOptions = {
mobile: "91988448XXXXX",// Mandatory param along with country dial code
otp: "XXXXXX"
}
sendOtp.sendOTP(aOptions).then(() => {
//Handle success result
}).catch(() => {
//Handle failure result
})
Verifying OTP message to the specified mobile number
const sendOtpService = require('msg91-sdk').SendOtpService;
const sendOtp = new sendOtpService("AUTH_KEY", "MESSAGE_TEMPLATE");
const aOptions = {
mobile: "91988448XXXXX",// (*) mobile number of the client
otp: "XXXXXX"// (*) OTP received from the client
}
sendOtp.verifyOTP(aOptions).then(() => {
//Handle success result
}).catch(() => {
//Handle failure result
})
Retry OTP message to the specified mobile number
const sendOtpService = require('msg91-sdk').SendOtpService;
const sendOtp = new sendOtpService("AUTH_KEY", "MESSAGE_TEMPLATE");
const aOptions = {
mobile: "91988448XXXXX",// (*) mobile number of the client
retrytype: "voice"// (optional) ["voice", "text"] "text" -> default one
}
sendOtp.retryOTP(aOptions).then(() => {
//Handle success result
}).catch(() => {
//Handle failure result
})
Sending sms to many messages to many users using a below snippet
const sendSmsService = require('msg91-sdk').SendSmsService;
const sendSms = new sendSmsService("AUTH_KEY", "SENDER_ID", "ROUTE_ID");
sendSms.senderId
const 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(mobileNumbers, messages, countryDialCode).then(() => {
//Handle success result
}).catch(() => {
//Handle failure result
})
sendSms.sendSMS("988448XXXXX", "Hello All", countryDialCode).then(() => {
//Handle success result
}).catch(() => {
//Handle failure result
})
sendSms.sendSMS("988448XXXXX,988458XXXXX,988468XXXXX", "Hello All,New Message", countryDialCode).then(() => {
//Handle success result
}).catch(() => {
//Handle failure result
})
Sending sms with flow
const sendSmsService = require('msg91-sdk').SendSmsService;
const sendSms = new sendSmsService("AUTH_KEY", "SENDER_ID", "ROUTE_ID");
sendSms.senderId
const mobileNumber = "91988448XXXXX" // mobile number of the user
const 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.sendSMSFlow(mobileNumber, templateId, params).then(() => {
//Handle success result
}).catch(() => {
//Handle failure result
})
Checking balance of the route type
require('msg91-sdk').getBalance("AUTH_KEY", "ROUTE_ID").then(() => {
//Handle success result
}).catch(() => {
//Handle failure result
})
Copyright (c) 2020 Naveen Kumar Kuppan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, 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 THE
SOFTWARE.
FAQs
This is used to handle msg91 apis such as send otp, sms and sms flow.
We found that msg91-sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.