@aasaanjobs/notifications-js-sdk

SDK to handle Aasaanjobs Notifications

Usage no npm install needed!

<script type="module">
  import aasaanjobsNotificationsJsSdk from 'https://cdn.skypack.dev/@aasaanjobs/notifications-js-sdk';
</script>

README

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();