Skip to main content
POST
/
v1
/
events
/
trigger
import { Novu } from '@novu/node';

const novu = new Novu("<NOVU_API_KEY>");

await novu.trigger('<WORKFLOW_TRIGGER_IDENTIFIER>',
  {
    to: {
      subscriberId: '<UNIQUE_SUBSCRIBER_IDENTIFIER>',
      email: 'john@doemail.com',
      firstName: 'John',
      lastName: 'Doe',
    },
    payload: {
      name: "Hello World",
      organization: {
        logo: 'https://happycorp.com/logo.png',
      },
    },
  }
);
{
    "data": {
        "acknowledged": true,
        "status": "processed",
        "transactionId": "string"
    }
}
Enter your API key in the Authorization field like the example shown below:E.g ApiKey 18d2e625f05d80e
import { Novu } from '@novu/node';

const novu = new Novu("<NOVU_API_KEY>");

await novu.trigger('<WORKFLOW_TRIGGER_IDENTIFIER>',
  {
    to: {
      subscriberId: '<UNIQUE_SUBSCRIBER_IDENTIFIER>',
      email: 'john@doemail.com',
      firstName: 'John',
      lastName: 'Doe',
    },
    payload: {
      name: "Hello World",
      organization: {
        logo: 'https://happycorp.com/logo.png',
      },
    },
  }
);
{
    "data": {
        "acknowledged": true,
        "status": "processed",
        "transactionId": "string"
    }
}

Idempotent nature of transactionId

The transactionId within Novu is a unique identifier that is used to ensure the idempotent nature of notification delivery.When you trigger an event to send a notification, you have the option to provide a transactionId. If you do not provide one, Novu will generate a UUID for you.This identifier is particularly useful for preventing the same notification from being sent multiple times in case the trigger event is inadvertently called more than once.By leveraging the transactionId, you can make idempotent requests, which means if the same transactionId is used in another request, Novu's API will recognize it and will not send the same notification again.
This upholds the principle of idempotency, ensuring that the effect of the operation is the same, no matter how many times the request is repeated with the same transactionId.

Body

application/json
name
string
required

The trigger identifier of the workflow you wish to send. This identifier can be found on the workflow page.

to
required

The recipients list of people who will receive the notification.

payload
object

The payload object is used to pass additional custom information that could be used to render the workflow, or perform routing rules based on it. This data will also be available when fetching the notifications feed from the API to display certain parts of the UI.

Example:
{
"comment_id": "string",
"post": { "text": "string" }
}
overrides
object

This could be used to override provider specific configurations

Example:
{ "fcm": { "data": { "key": "value" } } }
transactionId
string

A unique identifier for this transaction, we will generated a UUID if not provided.

actor

It is used to display the Avatar of the provided actor's subscriber id or actor object. If a new actor object is provided, we will create a new subscriber in our system

Unique identifier of a subscriber in your systems

tenant

It is used to specify a tenant context during trigger event. If a new tenant object is provided, we will create a new tenant.

Unique identifier of a tenant in your system

Response

Created

data
object
I