node.js module for sending sms messages through PSWinCom SMS Gateway.
$ npm install pswincom-gateway
The module exposes a single function called sendSms
(aliased to send_sms
and sendsms
to suit your preference).
var sendSms = require("pswincom-gateway").sendSms;
sendSms
can be invoked in several ways
sendSms(user, passwd, sender, receivers, msg);
where receivers
is an array of strings (phone numbers including country codes, with no leading zeros or plus sign).
sendSms(user, passwd, sender, receivers, msg,
function(result) {
console.log(result);
});
sendSms(user, passwd, sender, receivers, msg,
function(result) {
console.log("SMS result: ", result);
},
function(error) {
console.log("SMS error: ", error);
});
in which case done and error are still optional
sendSms({
user: "YOUR_USERNAME",
password: "YOUR_PASSWORD",
sender: "YOUR_SENDER",
receivers: [ "RECEIVER_1" ],
message: "A test message",
done: function(status) {
// ...
},
error: function(error) {
// ...
}
});
When you pass your arguments as an object you may also add some extra arguments that are sometime usefull:
deliveryTime
[Date object] for delayed deliveryoperation
[Number] for operation to perform on message (useful for unicode messages)- more to come...