In many cases, you will need to access all the digested events payload in order to show the user all or parts of the events included in this digest.For example: “John and 5 others liked your photo.”The digest function returns an array of triggers that have been digested.
You can use this array to perform any necessary actions on the digested triggers.
Like Sending and email, or updating a database.
const { events } = await step.digest('digest-3-days', async () => { return { unit: 'days', // 'seconds' | 'minutes' | 'hours' | 'days' | 'weeks' | 'months' amount: 3, // the number of units to digest events for };});await step.email('send-email', async () => { const eventCount = events.length; return { subject: 'Digest Email', body: `You have ${eventCount} new events`, };});
You can use a custom digest key to digest events based on a custom key. By default, events are digested based on the subscriberId. With a custom digest key, events are digested based on the combination of the subscriberId and the digestKey value.
Step controls: At the moment, it is not possible to use digest information in step controls. You
can only use it from the code, by creating a custom component for handling digested data.
The digest step returns an object with events array. Each event in the array has the following properties:
id - The job id of the digested event
time - The time when the event was triggered
payload - The original payload passed to the event
Currently, Novu does not support two digest steps in a workflow. However, two digest behaviours can be achieved by creating second workflow with digest step, add all other steps after the digest step and trigger the second workflow from the first workflow in custom step.Use Case: LLM-Powered Feedback DigestIn this example, customer requests are collected and digested every 15 minutes. An in-app notification alerts the user about the number of new requests. Every 6 hours, those requests are grouped and passed to a second workflow where an LLM (like OpenAI) categorizes the feedback into bugs, feature requests, and praise. A summary email is then sent with the categorized counts. This setup helps reduce noise while still keeping teams informed with meaningful, AI-powered insights.