nodejs SDK for the Notifications API, currently only support native push functionality.
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);
// ...