JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6
  • Score
    100M100P100Q42078F
  • License MIT

MiaJupiter Sms authentication

Package Exports

  • sms-auth
  • sms-auth/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (sms-auth) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Sms Send AuthCode

npm download GitHub Hits

Note: This package supports only Verimor Sms service.

Table of contents

Install

From npm source

npm install sms-auth

From github

npm install https://github.com/miajupiter/sms-auth.git

API Functions

Send Authentication Code

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  

Send SMS

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 }

Generating auth code

const sms=require('sms-auth')

const authCode = sms.generateAuthCode()

console.log(authCode)

Output:

// Generate auth code
474639

Is valid phone number?

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

License - MIT License

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.