@bcc-code/bcc-notifications-node-sdk
v3.1.0
Published
NodeJS client for bcc-code/bcc-notifications-node-sdk
Keywords
Readme
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: "...",
personUids: ["..."],
groupUids: ["..."],
notificationPayload: [
{
language: "en-US",
content: "Hi [firstName]!<br>Welcome to #devdays!",
title: "...",
imageUrl: "...",
data: {
actionUrl: "...",
},
}
]
};
const response = await client.sendNativePush(requestPayload);
/** SEND EMAIL **/
const sendEmailPayload = {
personUids: ["..."],
groupUids: ["..."],
notificationPayload: [
{
language: "en-US",
content: "Hi [firstName]!<br>Welcome to #devdays!",
subject: "Welcome to #devdays",
banner: "...", //image url
title: "Welcome",
subTitle: "..."
}
]
};
const response = await client.sendEmail(sendEmailPayload);
// ...