unismsgateway
v1.2.1
Published
A unified sms gateway library that brings access to multiple sms gateways under a single API
Downloads
7
Readme
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