Digest Action Step
The digest
step allows you to group events by a specified key and digest them together. This is useful when you need to group events by a specific key, such as a user ID, and then digest them together.
The result of the digest
step is an array of events that have been digested together, allowing you to create a single notification for each group of events.
Digest Step Output
Regular Digest
This combined with the unit field determines the amount of time to digest events for.
The measurement unit for the amount field.
This key is used to group events for the digest engine, if not provided all events will be digested together on the subscriber level.
When provided, events will be grouped by the subscriberId
and the digestKey
.
The digest key must match the payloadSchema
key provided on the workflow.
If a lookbackWindow
will be specified, the digest engine will check if any event was triggered within the past lookbackWindow
period.
If so, it will create a digest. Otherwise, it will send a message immediately and skip the digest creation. Learn more about the Look-Back strategy here.
Scheduled Digest
The cron expression to schedule the digest on a repeating basis.
@novu/framework
SDK exports a utility enum called CronExpression
to help you build cron expressions.
import { CronExpression } from '@novu/framework';
await step.digest('digest', async (controls) => {
return {
cron: CronExpression.EVERY_DAY_AT_1AM
}
});
This key is used to group events for the digest engine, if not provided all
events will be digested together on the subscriber level. When provided,
events will be grouped by the subscriberId
and the digestKey
.
Digest Step Result
An array of triggers that have been digested.