NPM : Dialog SMS Gateway Library

JavaScript library to send SMS through Dialog telecommunication service

This library will handle single or multiple SMS send functionality with Dialog telecommunications service.

npm install dialog-sms-service

How to use

const smsGatew…


This content originally appeared on DEV Community and was authored by Kasun Madusanka

JavaScript library to send SMS through Dialog telecommunication service

This library will handle single or multiple SMS send functionality with Dialog telecommunications service.

npm install dialog-sms-service

How to use

const smsGateway = require('dialog-sms-service');

(async () => {
  try {
    // set configuration
    await smsGateway.setConfig({
      digest: 'dialog_msg_digest_here',
      mask: 'dialog_msg_mask_here',
      user: 'dialog_msg_user_here',
      campaignName: 'dialog_msg_campaignName_here', //optional
    });

    //send message
    const result = await smsGateway.sendSMS('07XXXXXXXX', 'Dialog sms test');
    console.log(result);
  } catch (error) {
    console.log(error);
  }
})();

How to work

First needs to contact Dialog Axiata PLC to get credentials for the SMS gateway.

Note:- Please contact Dialog Axiata PLC in order to obtain following fields.

Field Description
Username User name for the Dialog SMS gateway account.
Password Password for the Dialog SMS gateway account.
mask Text that appears as the sender of the SMS. Eg:- PIZZAHUT

set configurations for the SMS gateway

// set configuration
await smsGateway.setConfig({
  digest: 'dialog_msg_digest_here',
  mask: 'dialog_msg_mask_here',
  user: 'dialog_msg_user_here',
  campaignName: 'dialog_msg_campaignName_here', //optional
});
Field Description
user Required. Username that will provided by Dialog.
mask Required. A String. SMS sender ID.Mask value provided by Dialog. Eg:- test (For the test account)
digest Required. md5 encripted values of password. {digest = md5(password provided by dialog)}
campaignName Optional. Campaign name to be used in reporting.

Send SMS

await smsGateway.sendSMS(Phone Number ,Message);
Field Description
Phone Number Required. A String. Phone number/s which will need to receive SMS. the phone number needs to either start with 0 or 94 (do not use +94). If there are multiple receivers make sure to add them as comma (,) separated text. Eg :- '0771111111,0712222222'
Message Required. A String. The content of the SMS goes here.

Licence

(The MIT License)
Copyright (c) 2021 kmkasunmadushanka@gmail.com


This content originally appeared on DEV Community and was authored by Kasun Madusanka


Print Share Comment Cite Upload Translate Updates
APA

Kasun Madusanka | Sciencx (2021-06-10T06:58:37+00:00) NPM : Dialog SMS Gateway Library. Retrieved from https://www.scien.cx/2021/06/10/npm-dialog-sms-gateway-library/

MLA
" » NPM : Dialog SMS Gateway Library." Kasun Madusanka | Sciencx - Thursday June 10, 2021, https://www.scien.cx/2021/06/10/npm-dialog-sms-gateway-library/
HARVARD
Kasun Madusanka | Sciencx Thursday June 10, 2021 » NPM : Dialog SMS Gateway Library., viewed ,<https://www.scien.cx/2021/06/10/npm-dialog-sms-gateway-library/>
VANCOUVER
Kasun Madusanka | Sciencx - » NPM : Dialog SMS Gateway Library. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/06/10/npm-dialog-sms-gateway-library/
CHICAGO
" » NPM : Dialog SMS Gateway Library." Kasun Madusanka | Sciencx - Accessed . https://www.scien.cx/2021/06/10/npm-dialog-sms-gateway-library/
IEEE
" » NPM : Dialog SMS Gateway Library." Kasun Madusanka | Sciencx [Online]. Available: https://www.scien.cx/2021/06/10/npm-dialog-sms-gateway-library/. [Accessed: ]
rf:citation
» NPM : Dialog SMS Gateway Library | Kasun Madusanka | Sciencx | https://www.scien.cx/2021/06/10/npm-dialog-sms-gateway-library/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.