Digest
Batch multiple alerts and send a summary of notifications at a recurring schedule to the user
The Digest node aggregates multiple triggers into a single, summarized notification sent at a recurring schedule. Some common usecases include sending recommendations or top stories like you get for Linkedin or Quora, or to send a weekly / daily summary of activities in a company workspace or SaaS application.
You can configure Digest nodes to send notifications on a fixed schedule to all users or a dynamic schedule based on user preferences.
Digest can be configured to be timezone-aware, ensuring that final notifications are sent in user’s preferred timezone and all users receive the digest at a reasonable hour.
How Digest works?
Opens batch window
When a workflow reaches the Digest node, it opens a batch until the next digest schedule is triggered. Unlike regular batching, the Digest node operates on a fixed schedule rather than being relative to when the first event is received. Consequently, the next steps following the Digest node will be executed at the fixed schedule, regardless of when triggers are received.
Accumulates trigger until the next digest schedule
During the batch period, all events for the same recipient with the same workflow slug are accumulated. A unique batch is created for each recipient.
Moves to next workflow step
When the digest schedule is reached, a single notification is sent for each batch. You can configure the number of events retained in the batch using the retain items setting. The digest output structure is similar to the batch output and templates can be edited in the same format as you do for batched alerts. Refer to Using Batch Variables in Templates for more details.
If no triggers are received within a given schedule or if the number of events is below the minimum trigger count, the workflow will exit without executing subsequent steps.
Example Usecase
A workflow sends a summary of task status changes daily at 7:00 PM for a workflow management tool.In this case, the workflow will batch all triggers for 11 hours (until July 30, 7:00 PM Europe/London) and the email will be sent at the same time as soon as batch is closed.
- Trigger: When task status is changed (First task status change is received at Jul 30, 7:00 am UTC)
- Digest Schedule: Daily at 7:00 pm (in recipient’s timezone)
- Recipient’s Timezone: Europe/London (UTC+1).
In this case, the workflow will batch all triggers for 11 hours (until July 30, 7:00 PM Europe/London) and the email will be sent at the same time as soon as batch is closed.
Configuring Digest schedule
It is the recurring schedule when an open digest should be closed. This schedule might differ from the time notifications are actually sent. For example, if you want to send a daily digest summarizing activities from the previous day at 9:00 AM, you would set the Digest schedule to close daily at midnight and follow it with Time Window or Delay node to send the notification at 9:00 AM.
Advanced Settings
Using Digest (Batch) variables in templates
Batch output variable has 2 type of variables:
$batched_events
array : All the event properties corresponding to a batched event is appended to this array and can be used in the template in the array format. The number of event properties returned here is limited by retain batch events.$batched_event_count
: This count represents the number of events in a batch and is utilized to render the batch count in a template. For instance, you might send a message like,Joe left 5 comments in the last 1 hour
where 5 corresponds to $batched_event_count.
📘 Please note that Retain items setting doesn’t impact the count, it just limits the number of trigger data returned in $batched_events
array.
Let’s understand the batch variable structure with an example of task comments with below notification content.
Here is a list of events triggered in the batched window:
Output variable of the batch will have $batched_events_count
and $batched_events
array of all properties passed in the event payload as shown below:
This is how you’ll add the variable in your template to render the desired notification content.
You can also test this behaviour via Enable batching
option in Mock data button on template details page. Once enabled, you’ll start getting $batched_events
variable in auto suggestion on typing {{
in template editor. The variables in mock data will be treated as event properties and Event Count
will imitate the number of times this event will be triggered in the batch.
Transforming Digest Variable Output
There can be cases where you need to split the digest output variables into multiple arrays based on keys in your input data. For example, to send a message like You have got 5 comments and 3 likes on your post today
where post and likes are interaction_type in your input payload. You can use data transform node and generate relevant variables using JSONNET editor to handle this usecase.
Let’s take below example. There are 3 post interactions, 2 comments and 1 like and this is your workflow trigger.
Without transformation, digest output will look like this:
We’ll add 3 variables in data transform node
comment_count
: to get the count of all interactions whereinteraction_type = comment
like_count
: to get the count of all interactions whereinteraction_type = like
all_comments
: to fetch all array objects whereinteraction type = comment
After data transform node, output variables will contain 3 additional keys generated above. You can use these variables in your template to send the desired message as You have got {{comment_count}} comments and {{like_count}} likes on your post today
.