Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ashokdey/msg91-promise
Promise wrapper for MSG91 API
https://github.com/ashokdey/msg91-promise
msg91 npm npm-package sms sms-api sms-messages
Last synced: about 1 month ago
JSON representation
Promise wrapper for MSG91 API
- Host: GitHub
- URL: https://github.com/ashokdey/msg91-promise
- Owner: ashokdey
- License: mit
- Created: 2017-11-16T07:40:35.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-11-16T11:04:29.000Z (about 7 years ago)
- Last Synced: 2024-08-10T22:57:33.061Z (5 months ago)
- Topics: msg91, npm, npm-package, sms, sms-api, sms-messages
- Language: JavaScript
- Size: 39.1 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# msg91-promise
Promise based Msg91 API for node.js[![NPM](https://nodei.co/npm/msg91-promise.png)](https://nodei.co/npm/msg91-promise/)
# Msg91 Installation
```javascript
npm install msg91-promise -S
yarn add msg91-promise
```# APIs
### ROUTE_NO
```javascript
1 - Promotional Route
4 - Transactional Route
```### USAGE
```javascript
const msg91 = require('msg91-promise');
const API_KEY = 'XXXXXXXXXXXXXXXXXXXX'; // Your API key
const SENDER_ID = 'TESTPR'; // Your sender id
const ROUTE = 4; // transactional routeconst msg91SMS = msg91(API_KEY, SENDER_ID, ROUTE);
const mobileNo = 'XXXXXXXXXX';
msg91SMS.send(mobileNo, 'MESSAGE')
.then(response => console.log(response))
.catch(err => console.log(err));// can also send sms to an array of numbers
const mobileList = ['XXXXXXXXXX', 'XXXXXXXXXX', 'XXXXXXXXXX'];msg91SMS.send(mobileList, 'MESSAGE')
.then(response => console.log(response))
.catch(err => console.log(err));// mobile numbers can be inside a CSV file
const mobileNoCSV = 'XXXXXXXXXX,XXXXXXXXXX,XXXXXXXXXX';// pass the CSV file containing mobile numbers
msg91SMS.send(mobileNoCSV, 'MESSAGE')
.then(response => console.log(response))
.catch(err => console.log(err));// check your balance
msg91SMS.getBalance()
.then(response => console.log(response))
.catch(err => console.log(err));// get balance for a particular route
msg91SMS.getBalance(ROUTE)
.then(response => console.log(response))
.catch(err => console.log(err));```