Digest
Aggregate and batch notifications with Enbbox digest steps. Reduce notification fatigue by combining multiple events into a single summary notification.
Digest Step
The Digest step aggregates multiple trigger events within a time window into a single notification, preventing notification fatigue.
const commentWorkflow = workflow("new-comments", async ({ step, payload }) => {
const digestResult = await step.digest("comment-digest", async () => ({
amount: 30,
unit: "minutes",
}));
await step.email("digest-email", async () => ({
subject: `You have ${digestResult.events.length} new comments`,
body: `
<h1>New Comments</h1>
<p>Here's what you missed:</p>
<ul>
${digestResult.events
.map((e) => `<li>${e.payload.authorName}: ${e.payload.comment}</li>`)
.join("")}
</ul>
`,
}));
});How It Works
- First trigger event starts the digest window
- Subsequent events within the window are collected
- After the window closes, all collected events are available as
digestResult.events - The next step receives the aggregated data
Options
| Option | Type | Description |
|---|---|---|
amount | number | Duration value |
unit | string | seconds, minutes, hours, days |
digestKey | string | Optional key to group events (e.g., by post ID) |
Use Cases
- Comment notifications — Batch comments on the same post
- Activity summaries — Daily or hourly activity digests
- Bulk updates — Combine multiple status changes
Chat Channel
Send chat notifications via Slack, Discord, and Microsoft Teams using the Enbbox Framework. Code-first workflow definition with TypeScript for chat channel delivery.
Delay
Add delay steps to Enbbox notification workflows. Schedule notifications with time-based delays, digest windows, and conditional timing in TypeScript.