The Batch Email Channel type batches notifications into periodic emails. The functionality for the channel is defined in Batch Email Channel Script.
The channel uses the Email template field to identify a template that controls the format of the email. This is assumed to be an instance of Batch email template, or a compatible email template.
The batch notification channel batches up emails for each recipient. The notifications are retained until a delay period has passed, and when the delay is reached that notification and all subsequently received notifications are sent on a single email. The delay period can be set in the options in the notification outcomes structure or in those on individual rules.
The delay is a number of minutes, and defaults to 60.
If the delay on a subsequent notification would require that the emails are sent earlier, the email is rescheduled to go earlier. For example.
- At 12:00, a notification is received with a delay of 120 minutes. The email send is scheduled for 14:00.
- At 12:15, another notification is received with a delay of 120 minutes. The email send is not rescheduled because the second notification could be included in the 14:00 email.
- At 12:30, a notification is received with a delay of 15 minutes. The email send is rescheduled for 12:45.
- At 12:45, all three notifications are sent on a single email.
The notifications for each recipient are arranged in a folder structure below the channel:
- Batch email channel
- Recipient, based on email address (repeats)
- Notification (repeats)
- Recipient, based on email address (repeats)
Each recipient is represented by a node of type Recipient Batch, with a local reference based on their email address. This node is used as the basis for scheduling, so each recipient has a separate email schedule.
Each individual notification is represented by a node within the recipient node. The notification nodes are deleted as the emails are sent. This approach is used, rather than building a list of notifications within a single node, as it copes better with notifications arriving while the email is being sent. Notification nodes base the local reference on the uuid in the incoming notification, and duplicate notifications are rejected within a single batch.