Note: This package supports only Verimor Sms service.
npm install sms-auth
npm install https://github.com/miajupiter/sms-auth.git
const sms=require('sms-auth')
const messageTemplate='This is your auth code:{authCode}'
const username='' // sms service username
const password='' // sms service password
const recipient='target phone number'
sms.sendAuthCode(username, password, recipient, messageTemplate)
.then(resp=>console.log(resp))
.catch(err=>console.error(err))
Output:
// Random generated auth code sent to target phone number
474639
const sms=require('sms-auth')
sms.sendSms({
url:'https://sms.verimor.com.tr/v2/send.json',
method:'POST',
data:{
username: '',
password: '',
messages:[{
msg:'Hello, world.',dest:'<phone number>'
}]
}
})
.then(resp=>console.log(resp))
.catch(err=>console.error(err))
Output:
HttpStatus: 200 OK
{ status: 200, data: 318438489 }
const sms=require('sms-auth')
const authCode = sms.generateAuthCode()
console.log(authCode)
Output:
// Generate auth code
474639
const sms=require('sms-auth')
const phoneNumber = '101111111111'
console.log(`Is '${phoneNumber}' valid phone number?\nResult:`, sms.validPhoneNumber())
Output:
Is '101111111111' valid phone number?
Result: false
Copyright (c) 2023-Now MiaJupiter Technology Inc.. All rights reserved. We are proud to be Open Source. For full details about the license, please check the LICENSE
file in the root directory of the source repository.