Hi, i am hepi-otp module. There are many (One Time Password) OTP providers in the world like Nexmo, Twilio, Zenziva, Raja-sms (adsmedia) etc. Which is the best? Noone, especialy for Indonesia. All of them are good, its depends on context and situations.
Hepi-otp make you happy to integrate the multiples providers easilly into your apps.
- initiate the providers
- activate it
- send the secret code
- get the response
npm install hepi-otp --save
var HepiOtp = require('hepi-otp').hepiOtp
var EngineAdsmedia = require('hepi-otp').EngineAdsmedia
var EngineZenziva = require('hepi-otp').EngineZenziva
var EngineNexmo = require('hepi-otp').EngineNexmo
var adsMedia = new EngineAdsmedia(DOMAIN, API_KEY)
var zenziva = new EngineZenziva(USER_KEY,SECRET_KEY,KEY)
var nexmo = new EngineNexmo(USER_KEY,TOKEN)
var hepiOtp = new HepiOtp()
hepiOtp.setEngine(zenziva)
var responseOtp = hepiOtp.sendOtp(RECEIPT_NUMBER,OTP_CODE)
responseOtp.then(succeesValue=>{
console.log('otp-success',succeesValue)
},fail=>{
console.log('otp-fail',fail)
})
.catch(error=>{
console.log('otp-error',error)
})
special for nexmo engine, you need to verify the code and request id
var responseVerifyOtp = hepiOtp.verifyOtp(OTP_CODE,REQUEST_ID)
responseVerifyOtp.then(succeesValue=>{
console.log('verify-success',succeesValue)
},fail=>{
console.log('verify-fail',fail)
})
.catch(error=>{
console.log('verify-error',error)
})
hepiOtp.setEngine(adsmedia)
then try to send the otp code again.
var responseBalance = hepiOtp.checkBalance()
responseBalance.then(succeesValue=>{
console.log('balance-success',succeesValue)
},fail=>{
console.log('balance-fail',fail)
})
.catch(error=>{
console.log('balance-error',error)
})
Arif Akbarul Huda