Skip to content

AminTaghikhani/sms-ir-nodejs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sms-ir-nodejs Build Status

SMS.ir sms provider nodejs module

Install

# with npm
$ npm install --save sms-ir

Usage

As early as possible in your application.

APIKEY and SECRETKEY

first of all you should get api key and secret key from sms.ir.

Token

then you should get token with this code

  • APIKEY your apiKey
  • SECRETKEY your secretKey
const {Token} = require('sms-ir')
const token = new Token();

const result = await token.get(APIKEY, SECRETKEY) // don't forget to write await

now you can use sms.ir api

Verification Code

now with token you can send verification code

  • tokenResult token get with Token class
  • PHONENUMBER is user phonenumber
  • CODE generated code
const {Token,VerificationCode} = require('sms-ir')
const token = new Token();
const verificationCode = new VerificationCode();

// your code

// when you need to use
const tokenResult = await token.get(APIKEY, SECRETKEY) // don't forget to write await
const verificationResult = await verificationCode.send(tokenResult, PHONENUMBER, CODE) // don't forget to write await

example

const {Token,VerificationCode} = require('sms-ir')
const token = new Token();
const verificationCode = new VerificationCode();

// your code

// when you need to use
const tokenResult = await token.get(APIKEY, SECRETKEY) // don't forget to write await
const verificationResult = await verificationCode.send(tokenResult, '09xxxxxxxxx', 12345) // don't forget to write await

Default Message

now with token you can send Message

  • tokenResult token get with Token class
  • PHONENUMBER array of user phone numbers only array you must send as parameter
  • MESSAGE array of message you should send as parameter
  • LINENUMBER your line number for sending
const {Token,Message} = require('sms-ir')
const token = new Token();
const message = new Message();

// your code

// when you need to use
const tokenResult = await token.get(APIKEY, SECRETKEY) // don't forget to write await
const messageResult = await message.send(tokenResult, PHONENUMBER, MESSAGE, LINENUMBER) // don't forget to write await

example

const {Token,Message} = require('sms-ir')
const token = new Token();
const message = new Message();

// your code

// when you need to use
const tokenResult = await token.get(APIKEY, SECRETKEY) // don't forget to write await
const messageResult = await message.send(tokenResult, ['09xxxxxxxxx'], ['message'], 'xxxxxxxxxxxxx') // don't forget to write await

About

SMS.ir sms provider nodejs module

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published