@msg91comm/otp
Version:
Package for sending OTP with msg91.
39 lines (26 loc) • 642 B
Markdown
# MSG91 OTP
Promise based library for the browser and nodejs.
### Setup Your MSG91 Account / Get Credentials - (https://msg91.com/in/send-otp/)
## Installing
```bash
$ npm install @msg91comm/otp
```
## Example
```js
import msg91 from "@msg91comm/otp";
msg91.setup({
authToken: "YOUR_AUTH_TOKEN",
templateId: "OTP_TEMPLATE_ID"
});
const otp = msg91.createOTP("MOBILE_NUMBER_WITH_COUNTRY_CODE");
// Send OTP
otp.send();
// Resend/ Retry OTP
otp.retry();
// Verify OTP
otp.verify("ENTER_OTP_RECEIVED_BY_USER");
```
### CommonJS
```js
const msg91 = require('@msg91comm/otp').default;
```