Introduction
Learn how to use Novu’s Digest engine to batch notifications. In this guide, you’ll learn how to aggregate multiple messages and send them off as one notification. Follow these steps:Getting started
Integrating Novu’s code-first workflow with React.Email for your Next.js application can be done in three steps- Create a fully-featured Novu NextJS app with the command below:
- Once this installation is complete, simply
cdinto the directory and start your app using thenpm run devcommand.
Digest engine and how it works
Novu’s Digest Engine is designed to consolidate multiple trigger events into a single cohesive message before delivering it to the subscriber. This functionality is essential for managing notification overload and ensuring that users receive meaningful, aggregated updates rather than being bombarded with numerous individual notifications. Here’s how it works:- Event Accumulation: The digest engine collects multiple trigger events based on a unique
subscriberIdto be delivered as one message. - Batching Events: The engine batches these events within a specified time interval. This interval can be configured in units of seconds, minutes, hours, days, weeks, or months.
- Delivery: After the accumulation period, the batched events are sent out as a single notification. This consolidated message reduces the frequency of notifications and provides the user with a summary of all relevant events.
How to digest in a code-first workflow:
- Write a workflow and add a digest node to it:
💡 In the digest node above, you can change the digest duration by setting a value to the key
amount and changing the value of unit to seconds, minutes, hours, days, weeks, or months- Here’s a simple client-side app with a handler function attached to the
submitevent:
- And the corresponding route that it hits once the event fires: