1.0.9 • Published 5 years ago

onfonsms v1.0.9

Weekly downloads
1
License
ISC
Repository
github
Last release
5 years ago

ONFON SMS Gateway API for Kenya

Install

npm install onfonsms --save

Test

npm test

Basic 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' 
}
1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago