Novu’s content creation tools allow developers to utilize a wealth of variables when designing notification workflows.

As developers construct workflows using Novu, certain status facets—results of batch functions and other steps in the workflow—are auto-generated and can be utilized to control the content displayed in notification templates.

These variables offer dynamic and automated properties that hold subscriber information, such as first and last name, email, phone, and avatar.

For example, developers can insert a subscriber’s first name into a workflow by using {{ subscriber.firstName }}.

In addition to the subscriber’s details, developers can use data payload variables that encapsulate dynamic data meant to be injected into the content of a workflow.

For instance, in the code example the variables username and resetLink are data payload variables that would be adjusted based on the workflow’s purpose.

The utilization of these variables allows Novu to deliver personalized notifications to the receiver, thus improving user experience and accomplishing better communication outcomes.

System Variables

Subscriber Variables

VariableTypeDescription
subscriberObjectRepresents someone who is intended to receive a notification.
firstNameStringThe first name of the subscriber.
lastNameStringThe last name of the subscriber.
emailStringThe subscriber’s email address.
phoneStringThe phone number associated with the subscriber.
avatarStringA URL or reference to the subscriber’s avatar or profile picture.
localeStringThe preferred locale or language of the subscriber.
subscriberIdStringUnique identifier for the subscriber.
dataObjectAn additional object that can hold custom subscriber data as key-value pairs.

Actor Variables

VariableTypeDescription
actorObjectA subscriber who initiates actions triggering events.
firstNameStringThe first name of the actor.
lastNameStringThe last name of the actor.
emailStringThe actor’s email address.
phoneStringThe phone number associated with the actor.
avatarStringA URL or reference to the actor’s avatar or profile picture.
localeStringThe preferred locale or language of the actor.
subscriberIdStringUnique identifier for the actor.
dataObjectAn additional object that can hold custom actor data as key-value pairs.

Step Variables

VariableTypeDescription
stepObjectA component in the execution of a workflow.
digestBooleanIndicates whether digest mode is active or not.
eventsArrayAn aggregated collection of events (that are stored when digest is active).
total_countNumberRepresents the total number of events in the digest.

Brand Variables

VariableTypeDescription
brandingObjectEnables customization of the notification’s visual identity.
logoStringInsert the brand logo.
colorStringSet the primary color of the notification based on the brand configuration.

Tenant Variables

VariableTypeDescription
tenantObjectGroup of users or an organization.
nameStringInsert the brand logo.
dataObjectAn additional object that can hold custom tenant data as key-value pairs.

Data Payload Variables

Data payload variables encompass the dynamic data intended to be injected into the content of a workflow. These variables are integral components of the payload object, forming part of the parameters for the trigger function.

Here’s a more illustrative example of how data payload variables can be employed:

curl -L -X POST 'https://api.novu.co/v1/events/trigger' \
-H 'Authorization: ApiKey <REPLACE_WITH_API_KEY>' \
-H 'Content-Type: application/json' \
--data-raw '{
    "name": "password-reset",
    "to": {
        "subscriberId": "6427e97d0136cef86a315c46",
        "email": "john.doe@acme.com"
    },
    "payload": {
        "username": "Jhontheman1969",
        "resetLink": "http://sample.info/password.reset",
        "securityEmail": "john.doe.backup@acme.com",
    }
}'

Within this code snippet, the variables username and resetLink are representative of data payload variables.

Importantly, it’s worth noting that the payload itself can encompass any serializable JSON object.

Avoid use of system reserved variables as normal variables. For example don’t use email as variable name because {{subscriber.email}} is a system reserved variable