1.0.4 • Published 2 years ago

routemobilesms v1.0.4

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

RouteMobileSms

RouteMobilleSms is a light weight module for sending sms and checking account balance using route mobile's api. It's nodejs wrapper for Route Mobile Bulk Http API Specification. You will need an official account inorder to use this.

Installation

npm install routemoiblesms --save

Usage/Examples

import {routeSms} from 'routeMobileSms'

// INITIALISE 
const conf = {
    host:'rslr.connectbind.com', 
    username:'username', 
    password: 'password', 
    protocol: 'http', 
    port: 8080
    }

const smsEngine = new routeSms(conf);
// OR
routeSms.config(conf);


smsEngine.sendSync({...})
smsEngine.sendAsync({...}).then(...).catch(...);
//OR
routeSms.sendSync({...})
routeSms.sendAsync({...}).then(...).catch(...);

SETTING CONFIGURATION GLOBALLY

smsEngine.conf = {type: 0, dlr: 0, source: 'Sender', url: ''}
// OR
routeSms.config(conf);

SENDING MESSAGING

// SYNCHRONOUSE MESSAGING
smsEngine.sendSync({From: 'Sender', To: 'destination' | ['destinations'], Content: 'message here'});
// routeSms.sendSync({From: 'Sender', To: 'destination' | ['destinations'], Content: 'message here'});

// SENDING WITH CONFIG
smsEngine.sendSync({From: 'Sender', To: 'destination' | ['destinations'], Content: 'message here', 
                    conf: {type: number, dlr: number, url: string}
});
// routeSms.sendSync({From: 'Sender', To: 'destination' | ['destinations'], Content: 'message here', 
//                     conf: {type: number, dlr: number, url: string}
// });

// ASYNCHRONOUSE MESSAGING
smsEngine.sendAsync({From: 'Sender', To: 'destination' | ['destinations'], Content: 'message here'})
.then(response=> {
    // Handle response here
      console.log(response)
    //[{status:'successful|Failed', code:'errocode', message:'status details', destination:'233241865786', id: 'messageId'}]
    }).catch(err => {
      console.log(err)
    });
;

// SENDING WITH CONFIG
smsEngine.sendAsync({From: 'Sender', To: 'destination' | ['destinations'], Content: 'message here', 
                    conf: {type: number, dlr: number, url: string}
}).then(response=> {
    // Handle response here
      console.log(response)
    //[{status:'successful|Failed', code:'errocode', message:'status details', destination:'233241865786', id: 'messageId'}]
    }).catch(err => {
      console.log(err)
    });

INTERPRET SMS RESPONSE

routeSms.sendAsync({...}).then(function(response){
  console.log(routeSms.convertResponse(response))
  //[{status:'successful|Failed', code:'errocode', message:'status details', destination:'xxxxxxxxxxx', id: 'messageId'}]
})

License

MIT

Authors

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago