Installation is done using the
npm install
command:
npm install nikita-sms
# or
yarn add nikita-sms
const NikitaSms = require('nikita-sms');
// Creates a new user with username and password
const user = new NikitaSms('username', 'password');
const recipient = '+37477918700'; //recipient number
const text = 'sms body text'; // sms text
const id = recipient.substring(1) + +new Date(); //sms id (number + timestamp)
const priority = '8'; //sms priority (optional) defalut: 8
user.sendSms(recipient, text, id).then((data) => {
console.log(data); // ⇨ 'OK'
});
user.getStatusSms(id).then((data) => {
console.log(data); // ⇨ {
// messages: [
// {
// 'message-id': '374779187001605872849862',
// channel: 'SMS',
// status: 'Delivered',
// 'status-date': '2020-11-20 15:47:33',
// description: ' '
// }
// ]
// }
});