1.0.0 • Published 8 months ago

node-twillo-otp-manager v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
8 months ago

Node twillo OTP manage

A nodejs package for verify mobile number , OTP or send sms by twilio. It's build over twilio node SDK.

Documentation

Installation

  npm install node-twillo-otp-manager

Inislize client

const accountSID = 'YOUR TWIILO ACCOUND SID';
const authToken = 'YOUR TWILLO AUTH TOKEN';
const serviceSID = "YOUR SERVICESID"
const otpManager = require('node-twillo-otp-manager')(accountSID ,authToken , serviceSID);

Create serviceSID

const friendlyName = "Your service name"; // required
const OTPLenght = "OTP lenght" // default 6
const options = {}; // non required
const res = await otpManager.createServiceSID(friendlyName , OTPLenght , options);
const serviceSID = res?.sid

Send OTP

const phone = "+918545624541" // phone number with contary code
const res = await otpManager.sendOTP(phone);
console.log('OTP send status : -' , res)

Verify OTP

const phone = "+918545624541" // phone number with contary code
const OTP = "YOU OTP";
const res = await otpManager.verifyOTP(phone , OTP);
console.log('OTP verify status : -' , res)

Send custem sms

const body = "YOU SMS BODY";
const to = '+915245652145' // recever phone number with contary code
const from  = 'YOUR twillo number';
const res = await otpManager.sendSMS(body , to , from)
console.log('sms send status : -' , res)

🔗 Let's in touch

linkedin

1.0.0

8 months ago