Enbbox Docs

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

  1. First trigger event starts the digest window
  2. Subsequent events within the window are collected
  3. After the window closes, all collected events are available as digestResult.events
  4. The next step receives the aggregated data

Options

OptionTypeDescription
amountnumberDuration value
unitstringseconds, minutes, hours, days
digestKeystringOptional 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

On this page