@aasaanjobs/notifications-js-sdk
v1.0.3
Published
SDK to handle Aasaanjobs Notifications
Downloads
12
Readme
Javascript Aasaanjobs Notifications SDK
All microservices which need to trigger notifications should import this library
Installation
npm install @aasaanjobs/notifications-js-sdk
Configuration
You need to set the following environment variables in your project
SQS_ACCESS_KEY
: The AWS SQS access keySQS_SECRET_KEY
: The AWS S3 access keyHUB_SQS_QUEUE_URL
: Notification Hub SQS Queue Name
Usage
Send an Email
let emailHub = new Email({
sendTo: '[email protected]',
templateUrl: 'https://s3-ap-southeast-1.amazonaws.com/aasaan-notifications/notifications-prod/empty-html-email.html',
handlebars: {
html_data: '<html>Hello World</html>'
},
subject: 'Testing my new library.'
},
{
accessKey: process.env.SQS_ACCESS_KEY,
secretKey: process.env.SQS_SECRET_KEY,
queueUrl: process.env.HUB_SQS_QUEUE_URL
});
emailHub.send();
Send a SMS
let hub = new SMS({
sendTo: '8698009017',
templateUrl: 'https://s3-ap-southeast-1.amazonaws.com/aasaan-notifications/notifications-prod/empty-html-email.html',
handlebars: {
html_data: 'Some Testing SMS'
},
logOnly: true
}, {
accessKey: process.env.SQS_ACCESS_KEY,
secretKey: process.env.SQS_SECRET_KEY,
queueUrl: process.env.HUB_SQS_QUEUE_URL
});
hub.send();