touchsms
v0.0.7
Published
A touchSMS helper library to send SMS.
Downloads
36
Maintainers
Readme
touchSMS
The offical helper library to send SMS with touchSMS
Installation
npm install touchsms
Usage
var touchSMS = require('touchsms');
// access token & token id can be generated at https://platform.touchsms.com.au/apis/
Send SMS
var sms = new touchSMS('access_token', 'token_id');
var smsOptions = {
number: 61491570156,
message: 'hello world',
senderid: 'touchSMS'
}
var result = sms.sendSms(smsOptions);
result.then(function(data) {
var json = JSON.parse(data);
console.log(json);
});
Output
{
code: 200,
errors: 0,
message: ''
}
View User Details
var result = sms.users();
result.then(function(data) {
var json = JSON.parse(data);
console.log(json);
});
Output
{
username: 'john.doe@sandbox',
credits: 5000,
senderid: 'sandboxAPI',
mobile: '61491570156',
code: 200
}
Examples
Examples can be found in examples
directory.
npm examples/sendsms.js
npm examples/users.js
Tests
Tests run through a Sandbox URL with Sandbox credentials.
You can update the tests with your own credentials and remove the final true
parameter on the touchSMS constructor.
npm test