Package Exports
- onfonsms
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (onfonsms) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
ONFON SMS Gateway API for Kenya
Install
npm install onfonsms --saveTest
npm testBasic Usage
//import library
const onfon = require('onfonsms');
//get data from database or ...
const Username = 'xxxx'; // onfon client username
const Password = 'xxxx'; // onfon client password
const PhoneNumber = '254xxxxxxxxx'; // to mobile number or recipient number
const Message = 'npm test super agent'; // sms text message
const SenderId = 'YYYYY'; // You can use your project or company name
const SmsId = Math.random().toString(36).replace('0.', '');
const obj = {
username: Username,
password: Password,
senderid: SenderId,
smsid: SmsId,
recipient: PhoneNumber,
message: Message
};
//send sms
new Promise((resolve, reject) => {
onfon(obj)
.then(res => {
resolve(true);
})
.catch(err => {
console.log('error: ', err);
reject(err);
});
});Expected ouput
{
response: 'xml response from onfon end'
}