@aasaanjobs/notifications-js-sdk
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

Javascript Aasaanjobs Notifications SDK npm version

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 key
  • SQS_SECRET_KEY: The AWS S3 access key
  • HUB_SQS_QUEUE_URL: Notification Hub SQS Queue Name

Usage

Send an Email

let emailHub = new Email({
  sendTo: 'sohel.tarir@aasaanjobs.com',
  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();

Readme

Keywords

Package Sidebar

Install

npm i @aasaanjobs/notifications-js-sdk

Weekly Downloads

2

Version

1.0.3

License

MIT

Unpacked Size

20.2 kB

Total Files

18

Last publish

Collaborators

  • sohel.tarir