Socket
Socket
Sign inDemoInstall

2factor

Package Overview
Dependencies
47
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.5 to 1.0.6

33

index.js

@@ -30,8 +30,3 @@ const request = require('request')

* is a string defining the type of balance to return.
<<<<<<< HEAD
* Type can be either 'SMS', 'TRANSACTIONAL_SMS' or 'PROMOTIONAL_SMS'.
=======
* Type can be either 'ALL', SMS', 'TRANSACTIONAL_SMS' or 'PROMOTIONAL_SMS'.
>>>>>>> d70cbc000cc24378c2ea1f0bc98d792d0cb693db
*
* Type can be either 'ALL', SMS', 'TRANSACTIONAL_SMS' or 'PROMOTIONAL_SMS'.*
* @param {string} type - The type of balance to return

@@ -56,18 +51,12 @@ * @return {Promise} A promise object that resolves after the api call has completed

}
this.balance('SMS').then(response => {
balances.sms = response.Details
this.balance('TRANSACTIONAL_SMS').then(response => {
balances.transactional = response.Details
this.balance('PROMOTIONAL_SMS').then(response => {
balances.promotional = response.Details
resolve(balances)
}).catch(error => {
reject(error)
})
}).catch(error => {
reject(error)
})
}).catch(error => {
reject(error)
})
let promises = []
promises.push(this.balance('SMS'))
promises.push(this.balance('TRANSACTIONAL_SMS'))
promises.push(this.balance('PROMOTIONAL_SMS'))
Promise.all(promises).then(results => {
balances.sms = results[0].Details
balances.transactional = results[1].Details
balances.promotional = results[2].Details
resolve(balances)
}).catch(reject)
return

@@ -74,0 +63,0 @@ } else if (type === 'SMS') {

{
"name": "2factor",
"version": "1.0.5",
"version": "1.0.6",
"description": "Simple node library for sending transactional/otp/promotional SMS in India using the 2factor.in APIs",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -14,2 +14,6 @@ # 2factor-node

## New in this version (1.0.6)
Open template / transactional SMS are now supported. Will add support for OTP messages but I don't have
any credits for it right now and can't afford to buy them.
## Usage

@@ -76,3 +80,3 @@ The module exports a constructor that returns new TwoFactor instances.

### To send a template SMS to a single user
### To send a template SMS to a multiple users
~~~~

@@ -86,4 +90,19 @@ TwoFactor.sendTemplate(['123456789','987654321'], 'YOUR SENDER ID', ['VAR1','VAR2', 'VAR3']).then((response) => {

### To send an transactional / open template SMS -
Please ensure that open template SMS is enabled for your account.
If it is not, create a new request for a template and specify the senderid you wish to use for
sending the Open Template SMS and write in the description that you want to enable open
template sending ie. dynamic content.
If you are sending to a single user, you can just put the phone number as the first parameter.
~~~~
TwoFactor.sendTransactional(["1234567890", "2103456789"], "Your message", 'YOUR SENDER ID')
.then((response) => {
console.log(response)
}, (error) => {
console.log(error)
})
~~~~
## Author
Hanut Singh Gusain <hanutsingh@gmail.com> [http://www.hanutsingh.in]
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc