Simple API implementation library for node.js
CoffeeScript JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Simple API library. All you basicly need is here - sending SMS and checking delivering status of sent messages.


The library is in npm repository, so you need simply run in command string:

npm i libsmsru


Usage is as simple as it can be. Require library (in this example it located in ./lib/, but you can install it to your node_modules directory):

var sms = require('libsmsru');

You need to authorise with your API ID:


or with your login and password:

sms.auth('login', 'pa$$w0rd');

Then just send SMS with text 'Пример SMS-сообщения' to number 79150000000 from sender

sms.send('79150000000', 'Пример SMS-сообщения', { from: '' }, onSend);

Note that in options object { from: '' } you can use all parameters from you want. Or you can just skip it and send SMS this way:

sms.send('79150000000', 'Пример SMS-сообщения', onSend);

This time SMS will be sent from default sender.

onSend is Callback function with two parameters: (err, answer). If err is null then you are lucky - your SMS has been successfully sent. If err is not null then SMS will not be delivered because of error occured while sending. You can view err.code (number error code) and err.message (human readable russian message). If err is null then answer is object like this:

    raw    : '100\n200007-300007\nbalance=199.03',
    smsId  : [ '200007-300007' ],
    status : '100',
    balance: '199.03'

raw is just raw answer from server. You probably don't need it until you perfectly know what you are doing (you do not need it even then).
smsId is array of SMS identifiers. You need it if you want to check sent SMS status.
status is message sending status code. Nomally it should be always '100'.
balance is you account balance in russian RUB.

When you successfully sent SMS, you probably want to know whether it came to receipient or not. You can do it simply calling one function:

sms.status('200007-300007', onStatus);

'200007-300007' is SMS identifier from onSend()'s answer.smsId array. Note that sms.status() can work only with one ID string, not with arrays.

onStatus is callback function (err, answer). If SMS can't be delivered at all (for any reason) then err will contain two fields: code (number code of error) and message (human readable error description in russian). If SMS delivered or in progress then err is null and answer is key-value object with the following parameters:

    raw    : '102',
    status : '102',
    message: 'Сообщение отправлено (в пути)'

raw is raw answer from which you don't need until debugging purposes.
status is code which shows SMS delivering status. Normally you need statuses '102' (means that SMS delivering is in progress) and '103' (means that SMS successfully delivered).
message is human readable message in russian.

That's all! You can also try well commented example (usecase.js if you want raw JavaScript).

If you want this library always stay actual you can:

  • donate (more info:
  • use from this access point: (it makes no differences for you but allow me to get a little money)
  • send SMS messages with this library (here is my agent code which makes no differences for you but allow me to get a little money)
  • comment, share, spread this library
  • send issues, pull requests

@license MIT
@version 0.0.2
@author Alexander Zubakov