🚀 Socket Launch Week 🚀 Day 5: Introducing Socket Fix.Learn More
Socket
Sign inDemoInstall
Socket

unismsgateway

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unismsgateway

A unified sms gateway library that brings access to multiple sms gateways under a single API

1.2.1
latest
Source
npm
Version published
Maintainers
1
Created
Source

Unified Sms Gateway

Most of the time a single project relies on multiple sms Gateway so it can switched if one goes off. However, each sms api specification is different from the other, hence the need to create separate implementation for each sms gateway.

Unified sms gateway is library that brings most common sms gateways under a Unified api. which means you only does one implementation in it works for all supported sms gateway. you just have select or switch your sms platform and your code still works fine like nothing has changed

Usage/Examples

const unisms = require('unismsgateway')

const param = { clientId, // hubtel sms client Id **optional
                clientSecret, // hubtel sms client secret ** optional
                username, // username for route sms
                password, // password for route sms
                host,  // host address eg. rslr.connectbind.....
                port} // port defaults to 8080

//init with prefered platform id. route => routemobile, hubtel => hubtel sms
// more sms services will be added or supported in the future
const gateway  = unisms.init({platformId:'route', param})

SEND MESSAGE


const testSms = async function(){
  try{
    // const gateway = unisms.getSmsPlatform();
     await gateway.quickSend({From:'xxxxx', To: xxxxxxxx, Content: 'Testing unisms', Type: 0}, (response)=>{
      console.log(response)
    }).then(r => {
      console.log(r)
    }).catch(err => {
      console.log(err)
    })
  }catch(err){
    console.log(err)
  }


}

SEND PERSONALIZED MESSAGE


const testSms = async function(){
  try{
    // const gateway = unisms.getSmsPlatform();
     await gateway.sendPersonalized({From:'xxxxx', 
                                    To: {to: 233XXXXXXXXX, values: ['Alpha', 65332]},  // [{to: 233XXXXXXXXX, values: ['Alpha', 65332]}, {to: 211XXXXXXXXX, values: ['James', 2000]}, ]
                                    Content: 'Testing unisms', 
                                    Type: 0}).then(r => {
      console.log(r)
    }).catch(err => {
      console.log(err)
    })
  }catch(err){
    console.log(err)
  }


}

supported bulk sms gateways

Hubtel bulk sms (Ghana) using hubtel-sms-extended routeMobile sms (India) using routemobilesms Nest SMS(Ghana) using nestsms

Roadmap

  • Additional browser support

  • Add more third party sms integrations

License

MIT

FAQs

Package last updated on 31 Dec 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts