sms-ir
v1.0.5
Published
SMS.ir website module
Downloads
5
Readme
sms-ir-nodejs
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 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
Verification Code
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
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 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
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