0.0.4 • Published 3 years ago

@practera/messaging-sdk v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

@practera/messaging-sdk

Facilitates the communication with the Practera messaging API.

Health

Quality Gate Status Coverage Security Rating Maintainability Rating Bugs Code Smells

Install

$ npm install @practera/messaging-sdk

Usage

setting up the client

JavaScript:

const Messages = require("@practera/messaging-sdk");

TypeScript:

import { Messages } from "@practera/messaging-sdk";

Sending a json to the messaging service

const client = new Messages.create(
  privateKey, // the private key used to sign the request
  service, // this will identify what public key to use to validate the token, the variable called ${service}_JWT will be used. The variable should contain a key called public and the public key as the value.
  url, // the URL of the messaging API, leave empty for production
);

// to perform the api call for the data
client.send({message: 'Hello world !!!'});

// a singleton has been created so after creating the initial client you can also call it using
Messages.instance.send({wow: "blah"});