Learn about batch node in workflow and how to use it to group similar notifications into a single notification.
Opens batch window
Aggregates incoming triggers
Move to next workflow step once batch window is closed
Flush first item immediately
which bypasses batch window and sends the first trigger immediately and accumulates the rest.
There are 3 types of window type: Fixed (fixed for all users), Dynamic (Passed in trigger payload), Relative (relative to a future timestamp, e.g. 10 minutes before task due time).
Fixed
\\\\\\\*\\\\\\\*d \\\\\\\*\\\\\\\*h \\\\\\\*\\\\\\\*m \\\\\\\*\\\\\\\*s
and it keeps the batch open for a fixed duration for all users. An example of using fixed batch window can be social media updates where you want to send alert to users about new comments or post likes after an hour from the first comment.Dynamic
.duration_key
.preferencs.alert_frequency
.50
, which will be considered as duration in seconds*\\\\\\\*d \\\\\\\*\\\\\\\*h \\\\\\\*\\\\\\\*m \\\\\\\*\\\\\\\*s
, where d = day, h = hour, m = minutes and s = secondsRelative
.timestamp
. If the dynamic interval is set as recipient property: ."$recipient".interval
track event
call used for defining unique batches of the events. By default, event will be batched per user. You can use batch key to create multiple batches per user. Batches are created for each unique distinct_id
and batch_key
combination. For instance, you can add post_id
as your batch key if you want to send separate notifications for comments on different LinkedIn posts.
$batched_events_count = 1
. You can use this count in your workflow or templates to customize content based on whether the notification is sent immediately or as part of a batch.
Example Use Case:
Send anomaly alert with first notification sent at the occurrence of first error and next alert sent after 30 minutes if there are further errors. These could be the template content for single vs batched trigger:
A new error encountered in your account - {{$batched_events.\\\\\\\[0\\\\\\\].error_message}}
{{$batched_events_count}} errors occurred in your account in the last 30 mins - {{#each $batched_events}}{{error_message}}{{/each}}
$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 retaining 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.$batched_events
array.$batched_events_count
and $batched_events
array of all properties passed in the event payload as shown below:
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.
You have got 5 comments and 3 likes on your post in the past 1 hour
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 use case.
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
You have got {{comment_count}} comments and {{like_count}} likes on your post in the past 1 hour.
.
What does this error in logs mean batch: this event was added to the running batch of a pre-existing workflow?
What happens when I have multiple batch nodes in a workflow?
Do you support per-user batch windows?