npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

smsru

v0.0.2

Published

Client for SMS.ru API

Readme

smsru

node js модуль для работы с API сервиса sms.ru

Установка

npm i smsru

Использование

Простая авторизация (с помощью api_id):

var sms = new (require('smsru'))({
    api_id   : '{api_id}'
});

Усиленная авторизация (с помощью логина и пароля):

var sms = new (require('smsru'))({
    login   : '{login}',
    password: '{password}'
    // модуль автоматически обновляет авторизацию каждые 10 минут
    //,autoToken: false для отключения обновления авторизации

(не рекомендуется)Усиленная авторизация (с помощью api_id, логина и пароля):

var sms = new (require('smsru'))({
    api_id  : '{api_id}'
    login   : '{login}',
    password: '{password}'
    // модуль автоматически обновляет авторизацию каждые 10 минут
    //,autoToken: false для отключения обновления авторизации
});

Отправка СМС:

sms.send({
    to: '79112223344,79115556677,79115552255',
    text: 'Hello Kitty!',
    from: 'Имя отправителя',
    time: 60*20*1000, //отложенная отправка, в данном случае, через 20 минут в миллисекундах 
    translit: false,
    test: false,
    partner_id: '58239' //[партнерка, скидка 10%](http://foxes.sms.ru)
  },
  function(err, id){
    if(err)
      console.log(err.message);
    console.log('id смс сообщения', id);//Например: 22125-2345258
});

Получения статуса СМС:

sms.status(id, function(err, result){
  if(err)
    return console.log(err.message);
  //100	Сообщение находится в нашей очереди
  //101	Сообщение передается оператору
  //102	Сообщение отправлено (в пути)
  //103	Сообщение доставлено
  console.log('Статус',result);
});

Получить стоимость отправки СМС:

sms.cost({
    to:   '+79252846225',
    text: 'Hello Kitty!'
},
  function(err, price, length){
    if(err)
      return console.log(err.message);
    console.log(price, length);
});

Баланс:

sms.balance(function(err, balance){
  if(err)
    return console.log(err.message);
  console.log('Баланс', balance); // Float
});

Дневной лимит:

sms.limit(function(err, availableDay, spentDay){
  if(err)
    return console.log(err.message);
  //availableDay - количество номеров, на которые вы можете отправлять сообщения внутри дня
  //spentDay - количество номеров, на которые вы уже отправили сообщения внутри текущего дня
  console.log(availableDay,spentDay); // Numbers
});

Отправители:

sms.senders(function(err, senders){
  if(err)
    return console.log(err.message);
  console.log(senders); //Array ['79823555523','']
});

Проверка валидности авторизации:

sms.check(function(err){
  if(err)
    return console.log(err.message);
  console.log('Авторизовано');    
});

Добавить номер в стоплист:

sms.stoplistAdd(
{
  phone: '79224443322',
  reason: 'ban for flood' //можно без reason
}, function (err) {
  if (err)
    return console.log(err.message);
  console.log('Номер 79224443322 удален из стоп-листа');
});

Получить номера стоплиста:

sms.stoplist(function (err, stoplist) {
  if (err)
    return console.log(err.message);
  console.log('Стоп-лист', stoplist); // Array [{phone: '79224443322', reason:'ban for flood'}]
});

Удалить номер из стоплиста:

sms.stoplistDel({phone: '79224443322',}, function (err) {
  if (err)
    return console.log(err.message);
  console.log('Номер 79224443322 удален из стоп-листа');
});   

Автор

Alexey Petrushin, e-mail: [email protected]