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

smsowl

v1.2.0

Published

Wrapper for smsowl.in REST API.

Downloads

9

Readme

Sms Owl Node.js Wrapper

This package is wrapper of Sms Owl REST API hosted at https://smsowl.in. Sms Owl provides transactional and promotional SMS Gateway services.

Installing Sms Owl package

Use following command to install npm package.

$ npm install smsowl

Requiring library

Library can be imported to node file with following line of code.

var smsOwl = require("smsowl");

Configuring credentials

Credentials should be configured before sending SMS.

smsowl.configure({
    accountId: "YOUR-ACCOUNT-ID",
    apiKey: "YOUR-API-KEY"
});

Sending promotional SMS

sendPromotionalSms(senderId,to,message,smsType,callback)
  • senderId: Sender Id registered and approved in Sms Owl portal.

  • to: Either single number with country code or array of phone numbers.

  • message: Message to be sent.

  • smsType: It can have either of two values normal or flash

  • callback: Function to be called after success of failure.

     smsowl.sendPromotionalSms("TESTER",["+919876543210","+91123456789],"hello world","normal",function(error,result){
     	if(error){
         	// Handle Error
     	}else{
        		// Handle success
     	}
     });

Variable result will content SMS id for single message sent or array of SMS ids for bulk sms sent.

sendPromotionalSms(senderId,to,message,callback)

Same as above but smsType defaults to normal

Sending Transactional SMS

smsowl.sendTransactionalSms(senderId,to,templateId,placeholderObject,callback);
  • senderId: Sender Id registered and approved in Sms Owl portal.
  • to: Destination number with country prefix. Only single number can be specified.
  • templateId: Template Id of message. Only template message can be send via transactional route.
  • placeholderObject: Placeholder values.

Lets assume templateId of "39ec9de0efa8a48cb6e60ee5" with following template.

Hello {customerName}, your invoice amount is Rs. {amount}.

smsowl.sendTransactionalSms("TESTER","+919876543210","39ec9de0efa8a48cb6e60ee5",{customerName:"Bob",amount:500},function(error,result){
    if(error){
        //Handle error
    }else{
        //Handle success
    }
});

Variable result will content SMS id

Promise Pattern

Our API also support promise pattern. In above mentioned APIs just omit callback parameter and use returned promise. Following is example.

smsowl.sendPromotionalSms("TESTER","+919876543210","hello world")
    .then(function(result){
      	//handle success
    },function(error){
        //handle error
    });

Error object structure

On failure following object is sent to 1 parameter (error) of callback of to 1st parameter of promise's failure callback. The message field explains cause of error.

{
    "status": "error",
    "message" : "Description of error"
}