POST
/
v1
/
events
/
trigger
/
bulk
import { Novu } from "@novu/api";

const novu = new Novu({
  secretKey: "YOUR_SECRET_KEY_HERE",
});

async function run() {
  const result = await novu.triggerBulk({
    events: [
      {
        workflowId: "workflow_identifier",
        payload: {
          "comment_id": "string",
          "post": {
            "text": "string",
          },
        },
        overrides: {
          "fcm": {
            "data": {
              "key": "value",
            },
          },
        },
        to: {
          subscriberId: "<id>",
        },
      },
      {
        workflowId: "workflow_identifier",
        payload: {
          "comment_id": "string",
          "post": {
            "text": "string",
          },
        },
        overrides: {
          "fcm": {
            "data": {
              "key": "value",
            },
          },
        },
        to: [
          {
            topicKey: "<value>",
            type: "Subscriber",
          },
        ],
      },
      {
        workflowId: "workflow_identifier",
        payload: {
          "comment_id": "string",
          "post": {
            "text": "string",
          },
        },
        overrides: {
          "fcm": {
            "data": {
              "key": "value",
            },
          },
        },
        to: [
          "SUBSCRIBER_ID",
          "SUBSCRIBER_ID",
        ],
      },
    ],
  });

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

run();
[
  {
    "acknowledged": true,
    "status": "error",
    "error": [
      "<string>"
    ],
    "transactionId": "<string>"
  }
]

Authorizations

Authorization
string
header
required

API key authentication. Allowed headers-- "Authorization: ApiKey <api_key>".

Headers

idempotency-key
string

A header for idempotency purposes

Body

application/json
events
object[]
required

Response

201
application/json
Created
acknowledged
boolean
required

Indicates whether the trigger was acknowledged or not

status
enum<string>
required

Status of the trigger

Available options:
error,
trigger_not_active,
no_workflow_active_steps_defined,
no_workflow_steps_defined,
processed,
no_tenant_found,
invalid_recipients
error
string[]

In case of an error, this field will contain the error message(s)

transactionId
string

The returned transaction ID of the trigger