Leverage the digest functionality to send email notifications
Workflows
on the left sidebar of your Novu dashboard.Create Workflow
button on the top right:Creating workflows is simple
create workflow
button, you’ll see a dropdown. Select blank workflow
from the dropdown:
Select 'blank workflow' from the dropdown
Workflow editor allows you to create and edit workflows
Email
channel. You’ll also see the Digest
action on the right sidebar.
digest
action below the trigger node
, and add the email
channel node below the digest
node as shown below:
Adding a digest node to an email notification workflow
digest
node allows you to set a specific time interval for when notifications should be sent:
Setting time-interval in digest node
email
channel as per your need:
Configuring the email node as per our requirements
update
button on the top right.
It’ll automatically create a trigger code that you can use in your app. To get it, click on the get snippet
button on the top right and copy it:
Getting trigger code is simple
novu.js
, in our case) and the trigger function is getting called in the controller function above by the name getEmailDigest
.
If you’re following the guide, you’ve already copied the trigger function. But before we can add it to our app, we need one key thing - Subscribers.
Subscribers are users to which the notifications are sent. You can see a list of subscribers in the Novu dashboard as well.
In our app, we’ll create a subscriber in Node.js as we’re writing our backend in Node.js, but we also have backend SDKs (Node.js, PHP, .NET, Elixir, Go, Ruby, Python, and Kotlin) to choose from. The recommended way to create a subscriber in NodeJS is as follows:
subscriberID
of digestEmailSub.
In most real-world scenarios, the subscriberId
should be an alphanumeric entity like adfa67y87ad0
. You can read more about subscribers here.
Back in our app, we can now add the trigger function:
Filtering by channel