Skip to content

Latest commit

 

History

History
97 lines (70 loc) · 1.38 KB

USAGE.md

File metadata and controls

97 lines (70 loc) · 1.38 KB

Cancel Triggered Event

import { Novu } from "@novu/api";

const novu = new Novu({
  apiKey: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await novu.cancel("<value>");

  // Handle the result
  console.log(result);
}

run();

Trigger Notification Event

import { Novu } from "@novu/api";

const novu = new Novu({
  apiKey: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await novu.trigger({
    name: "workflow_identifier",
    overrides: {},
    payload: {},
    to: [
      {
        topicKey: "<value>",
        type: "Topic",
      },
    ],
  });

  // Handle the result
  console.log(result);
}

run();

Broadcast Event to All

import { Novu } from "@novu/api";

const novu = new Novu({
  apiKey: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await novu.triggerBroadcast({
    name: "<value>",
    overrides: {},
    payload: {},
  });

  // Handle the result
  console.log(result);
}

run();

Trigger Notification Events in Bulk

import { Novu } from "@novu/api";

const novu = new Novu({
  apiKey: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await novu.triggerBulk({
    events: [],
  });

  // Handle the result
  console.log(result);
}

run();