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 🙏

© 2024 – Pkg Stats / Ryan Hefner

smsapi-pl

v0.2.0

Published

SMSAPI.pl implementation for node.js

Downloads

13

Readme

smsapi-pl

Implementation of SMSAPI.pl for node.js With this package you can easily send SMS by Polish provider www.smsapi.pl Version 0.2.0

news:

  • added send promise

Usage:

$npm install smsapi-pl

then:

var sms = require('smsapi-pl');

You can put anything provided by smsapi.pl for HTTPS protocol http://www.smsapi.pl/sms-api/interfejs-https

First step:

Create config object
var senderConfig = {
    username: 'yourUsername',
    password: 'yourPass'
    encoding: 'utf-8',
    normalize: 1
};
Create local sender object.
var sender = new sms.API(senderConfig)
OR set app scope sender object

var sender = sms.setSender(senderConfig);

//sender == sms.sender // true
//sender instanceof sms.API //true
//every next require('smsapi-pl').sender is this sender object

Second step:

Compose messages
var msgOptions = {
    from: 'yourName',
    to: '+48500500500',
    message:'Hello world!'
};

//OR

var msg = new sms.Message(msgOptions)

//OR

var msg = new sms.Message();

msg
  .to(['+48500000000', 600000000, 48600000000])
  .params(['John','Maria','Whoever'], ['CP2255', 'CP2572', 'CP3673']);
  .template('new')
  .test();
  
//creating Message instances is useful when you are sending arrays  

Third step:

Send it...

It doesnt matter if you are sending Message instance or raw object.

sender.send(msg || msgOptions, function(err, response){
    console.log(err, response)
});
OR get send promise
var sendPromise = sender.promise(msg || msgOptions)

Implemented methods

API (sender object from examples)

  • sender.send(msg, callback) - validates username and password existance, catches errors
  • sender.promise(msg) - returns sender.send promise
  • sender.username('username') - username setter
  • sender.password('password') - password setter
  • sender.url('url') - api url request setter (default https://ssl.smsapi.pl/sms.do)

Message (msg object from examples)

  • msg.to(numberOrNumbers) - numbers: string, number or array. If number length != 9 or 11 ignores it.
  • msg.message('someMessage') - message setter
  • msg.test() - dry run (simulates SMS sending)
  • msg.template('templateName') - template name setter (templates provided by smsapi.pl)
  • msg.*params(args) - strings, numbers or arrays. Parameters for templates.

Check test.js