npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@kbabichau/uns-rest-integration-client

v1.2.3

Published

notifications.epam.com REST integration client

Downloads

37

Readme

UnsRESTClient

The UnsRESTClient module is a Node.js package that provides an API for interacting with the Unified Notifications Service (UNS) REST API.

Installation

npm install @kbabichau/uns-rest-integration-client

Usage

To use UnsRESTClient, first import it at the top of your script:

import UnsRESTClient, { UnsEnvironment } from '@kbabichau/uns-rest-integration-client';

Then, create an instance of the UnsRESTClient class by passing a configuration object to its constructor:

const client = new UnsRESTClient({
  environment: UnsEnvironment.QA, // Specify the environment as `UnsEnvironment.QA` or `UnsEnvironment.Production`
  tenant: 'your-tenant-name',
  host: 'https://notification-qa.epm-ppa.projects.epam.com',
  clientId: 'your-client-id',
  clientSecret: 'your-client-secret',
  unsClientId: 'uns-client-id'
});

Once you have an instance of the UnsRESTClient, you can use its sendEmail method to send email notifications:

const response = await client.sendEmail({
  template: 'your-email-template', // The name of your email template
  to: '[email protected]', // The email address of the recipient(s)
  cc: '[email protected]', // Optional: The email address of the person(s) to cc on the email
  data: { // The payload data for your email template
    firstName: 'John',
    lastName: 'Doe'
  }
});

This will send an email notification using the specified email template to the specified email address.

API

new UnsRESTClient(options)

Returns a new instance of the UnsRESTClient class. Takes an object with the following properties:

  • environment (UnsEnvironment) - The environment in which you're using UNS.
  • tenant (string) - The name of the tenant for whom the notification is being sent.
  • host (string) - The host URL for the UNS REST API.
  • unsClientId (string) - The client ID for your UNS application.
  • clientId (string) - The client ID for your application.
  • clientSecret (string) - The client secret for your application.

UnsRESTClient.sendEmail(payload)

Sends an email notification using the specified email template and recipient email address.

Takes an object with the following properties:

  • template (string) - The name of the email template being used.
  • to (string | string[]) - The email address of the recipient(s) of the email.
  • cc (string | string[] | undefined) - (optional) Additional email addresses to cc on the email.
  • data (object) - The data payload for the email.

Returns a Promise that resolves with the response object from UNS.

UnsEnvironment

An enum containing the possible environment types for the UnsRESTClient constructor. Possible values are QA and Production.

License

MIT