@doxiva/notification_handler
v1.0.4
Published
Doxiva Notification Handler is a single library to support SMS and EMAIL with multiple providers like twilio, gsuite etc.
Downloads
1
Readme
Doxiva Notification Handler
Doxiva Notification Handler is a single library to support SMS and EMAIL with multiple providers like twilio, gsuite etc.
Installation
npm i @doxiva/notification_handler --save
To send an SMS using Twilio
const { SMSHandler } = require('@doxiva/notification_handler');
let provider = new SMSHandler('twilio', {
ACCOUNT_SID: "XXXXXX",
AUTH_TOKEN: "XXXXXXX",
TWILIO_NUMBER: "XXXXX"
});
provider.send('+91XXXXXXXXXX', 'Welcome!');
To send an Email using Gsuite
const { EmailHandler } = require('@doxiva/notification_handler');
let provider = new EmailHandler('gsuite', {
HOST: 'smtp.gmail.com',
PORT: '465',
AUTH_TYPE: 'OAuth2',
AUTH_USER: '[email protected]',
CLIENT_ID: 'XXXXXXXXXXXXXX',
PRIVATE_KEY: 'XXXXXXXX--XXXXXXXX',
FROM: 'XXX <[email protected]>'
});
provider.send('[email protected]', 'Welcome!', "<html><head></head><body>Welcome to the notification handler</body></html>");
Thanks!