1.0.0 • Published 9 years ago

node-smsukraine v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

NodeJS module for SMS Ukraine service

Node module for using API of service smsukraine.com.ua. The full list of API methods and it's params you can find here.

Installing

npm install node-smsukraine

Usage

You can use two methods for setting login and pass: global and local.

With global method you can set login, pass and sms name for each request:

var SmsUkraine = require("smsukraine");
var sms = new SmsUkraine({login: "my_login", pass: "my_pass", name: "my_sms_name"});
  • login - your login in the system;
  • pass - your password;
  • name - your sms name;

With local method you can set login, pass and sms name for current request

sms.status({id: "248919871", login: "my_login", pass: "my_pass"}, function(err, sms_data){
	if(err) return console.log(JSON.stringify(err));
	console.log(JSON.stringify(sms_data));
})

Methods

Send SMS

var data = {"to": "380971234567", "text": "Hello world!"}
sms.send(data, function(err, sms_data){
	if(err) return console.log(JSON.stringify(err));
	console.log(JSON.stringify(sms_data));
})

For parameter data.to you can use differen types of mobile number. For example:

  • +38 (097) 123-45-67
  • 097 123 45 67
  • 80971234567
  • etc.

With successful request you will receive message with SMS id and SMS count:

{
	"id": 123456,
	"sms_count": 2
}

Check status

sms.status(248919871, function(err, sms_data){
	if(err) return console.log("err:" + JSON.stringify(err));
	console.log(JSON.stringify(sms_data));
})

Where id - sended SMS id.

With successful request you will receive status and code:

{
	"code": 2,
	"status": "Доставлено",
	"status_time":"2015-05-10T15:06:21+0300"
}

Check balance

sms.balance(function(err, balance){
	if(err) return console.log(JSON.stringify(err));
	console.log("balance: " + balance);
})

Contacts

Jaroslav Khorshchenko websnipter@gmail.com