SMS.ir sms provider nodejs module
# with npm
$ npm install --save sms-ir
As early as possible in your application.
first of all you should get api key
and secret key
from sms.ir.
then you should get token with this code
APIKEY
your apiKeySECRETKEY
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
now with token you can send verification code
tokenResult
token get with Token classPHONENUMBER
is user phonenumberCODE
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
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
now with token you can send Message
tokenResult
token get with Token classPHONENUMBER
array of user phone numbers only array you must send as parameterMESSAGE
array of message you should send as parameterLINENUMBER
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
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