Learn how to customize your notifications flow in Novu.
payload
: You can specify a list of keywords or values that the payload
field must match in order for the notification to be delivered. This is useful if you only want to receive notifications that contain certain information.subscriber
: You can filter which subscriber should receive notifications based on subscriber information. This means that you can send notifications to specific individuals or groups rather than all subscribers. It checks on subscriber attributes. Read more about subscriber attributes.webhook
: You can use this feature to provide information about subscribers from specified webhook response and use that information to filter the notification flow. For example, if your webhook returns a field indicating whether a subscriber is currently online, you can use this field to send notifications only to online subscribers.online right now
: You can filter notifications on the basis of the current online status of the subscriber. For example, You can choose to send a notification if the subscriber is currently online or offline.online in the last "X" time period
: You can use this to filter notifications for a subscriber if the subscriber was online in the last X
minutes/hours/days.Add conditions
AND
and OR
. This will determine how the conditions are applied to the notification. For example, if you choose AND
, the notification will only be delivered if all of the conditions are met. If you choose OR
, the notification will be delivered if any of the conditions are met.payload
, subscriber
, or webhook
field as the basis for your rule. For example, you might specify that the payload
field must contain a certain keyword or that the subscriber
must be in a specific group.Payload
, Subscriber
, or Webhook
response.On
field is Subscriber
, the Key
field might be name
, email
etc.value
to compare to the object key value using the selected operator
. The value field also accepts variables.Accept variables as value in setting conditions
isOnline
that is set to true
.
Webhook conditions
nv-hmac-256
header as a security measure.
This header contains an HMAC hash that is calculated based on your API Key
and Environment Id
, ensuring that the request is coming from Novu.
This helps in protection against unauthorized access and tampering with your webhooks.
To verify the authenticity of the request, you can use the following code:
ENVIRONMENT_ID can be accessed in the webhook subscriber parameter in the request body. NOVU_API_KEY can be found in the settings section of the Novu client.The webhook should return a one-level object containing any information that you want to use to filter the notification flow. For example, you might include a field called
isOnline
having value true
or false
that specifies whether the subscriber is currently online or not.
subscriber's
online status. The condition can be applied to determine if the subscriber is currently online or if the subscriber was online in the X time-period.
Example : To send an email notification to all subscribers who were active within the last 30 minutes, follow these steps:
Email
step after trigger in workflow.Add conditions
button from the upper right position.Add conditions
Add condition
to add a rule.Last time was online
and choose minutes
as the time period.30
in the input field.Subscriber online conditions
notification-center
package to track the online status of subscribers. The isOnline
and lastOnlineAt
fields of the subscriber’s entity are updated accordingly.
When a subscriber comes online, an active websocket connection is established with the server. Novu then updates the isOnline
field of the subscriber’s entity to isOnline: true
. When the subscriber disconnects, Novu updates isOnline: false
and lastOnlineAt: current_timestamp
.
The online condition feature can be used to determine if a subscriber is online right now or if the subscriber was online within a specific time period.
isOnline
field. If isOnline
is true
, the subscriber is online, otherwise when the isOnline
is false
the subscriber is considered offline.isOnline
and lastOnlineAt
fields. If isOnline
is true
, the subscriber is still online and the condition is applied. If isOnline
is false
, the difference between the current timestamp
and the timestamp
value of lastOnlineAt
is calculated. If this difference is within the specified time period, the subscriber was online within that time period and the condition is applied. Otherwise, the condition is not applied.lastOnlineAt
timestamp value is less than or equal to 5 minutes ago. If either of these conditions are met, the condition is applied.
Subscriber seen and read condition
email
provider you’re using on Novu. It’s very essential for the condition to work. No extra set up is needed for in-app
notifications. key
exists or not. It is different from Equal
and Not equal
condition. Equal
and Not equal
condition checks whether key value is equal to specified value or not, but Is Defined
condition just checks whether key is present or not.
Is Defined conditions
Activity Feed
page.
Execution Details
will open up.