@bcc-code/bcc-notifications-node-sdk
TypeScript icon, indicating that this package has built-in type declarations

1.5.0 • Public • Published

nodejs SDK for the Notifications API, currently only support native push functionality.

Example usage

import { Client, Environment } from "@bcc-code/bcc-notifications-node-sdk";

/** CLIENT CONFIG **/
const clientConfig = {
  environment: Environment.Prod,
  clientId: "...",
  clientSecret: "...",
};
const client = new Client(clientConfig);

/** NATIVE PUSH **/
const requestPayload = {
  sender: "...",
  title: "...",
  body: "...",
  personUids: ["..."],
  imageUrl: "...",
  data: {
    actionUrl: "...",
  },
};

const response = await client.sendNativePush(requestPayload);


/** SEND EMAIL **/
const sendEmailPayload = {
  recipients: [
    {
      firstName: "...",
      lastName: "...",
      email: "...",
      languages: [ "en", "no" ]
    }
  ],
  personUids: ["..."],
  groupUids: ["..."],
  notificationPayload: [
    {
      language: "en",
      content: "Hi [firstName]!<br>Welcome to #devdays!",
      additionalParameters: { ... },
      subject: "Welcome to #devdays",
      banner: "...", //image url
      title: "Welcome",
      subtitle: "..."
    }
  ]
};

const response = await client.sendEmail(sendEmailPayload);


// ...

Readme

Keywords

none

Package Sidebar

Install

npm i @bcc-code/bcc-notifications-node-sdk

Weekly Downloads

108

Version

1.5.0

License

Apache-2.0

Unpacked Size

31.9 kB

Total Files

32

Last publish

Collaborators

  • karsten.kuepper
  • mdebelak
  • it.accounts
  • fredrikved
  • laurensgroeneveld
  • u12206050
  • jakubc-projects