1.2.0 • Published 6 years ago
yellowpushsms v1.2.0
YellowPush SMS API - Node.js
Installation
The easiest way to install the library is using npm, a manager package for JavaScript. Simply run this in the terminal:
npm install yellowpushsms
YellowPushSMS Reference
YellowPush API needs your YellowPush credentials. You can either pass these directly to the start method (see the code below).
var yellowPushMS = require('yellowpushsms');
yellowPushMS.start('username', 'password');
NOTE: For better performance you can pass credentials and the account Identifier directly to the start method (see the code below)
var yellowPushMS = require('yellowpushsms');
yellowPushMS.start('username', 'password', 'accountId');
YellowPushSMS parameters:
- username: Your account user
- password: Your account password
- accountId: Your account identifier (optional)
Send an SMS
Sends a text message to one or more mobile numbers
var yellowPushMS = require('yellowpushsms');
yellowPushMS.start('username', 'password', 'accountId');
var response = yellowPushMS.sendSMS('from', 'message', 'mobileNumberOne,mobileNumberTwo');
response.then((response) => {
console.log(response);
}).catch(error => {
console.log(error);
});
Send Bulk SMS
Sends single, bulk text messages
var yellowPushMS = require('yellowpushsms');
yellowPushMS.start('username', 'password', 'accountId');
var messages = [
{ from: 'from',
to: 'mobileNumberOne',
message: 'message one' },
{ from: 'from',
to: 'mobileNumberTwo',
message: 'message two' }
];
var response = yellowPushMS.bulkSendSMS(messages);
response.then((response) => {
console.log(response);
}).catch(error => {
console.log(error);
});
Gets message status
Gets the messages satatus
var yellowPushMS = require('yellowpushsms');
yellowPushMS.start('username', 'password', 'accountId');
var response = yellowPushMS.getMessageStatus('messsageId', new Date('2018-03-06'))
response.then((response) => {
console.log(response);
}).catch(error => {
console.log(error);
});