Enbbox Docs

Digest Notifications

Implement notification digests with Enbbox. Reduce notification fatigue by batching multiple events into periodic summary notifications.

Digest notifications combine multiple events into a single notification, reducing noise and improving user experience.

Example: Comment Digest

Instead of sending a notification for every comment, batch them:

const commentDigest = workflow("comment-digest", async ({ step, payload }) => {
  const digest = await step.digest("batch-comments", async () => ({
    amount: 30,
    unit: "minutes",
  }));

  await step.email("digest-email", async () => ({
    subject: `${digest.events.length} new comments on your post`,
    body: `
      <h2>New Comments</h2>
      ${digest.events
        .map(
          (e) => `
        <div>
          <strong>${e.payload.author}</strong>: ${e.payload.comment}
        </div>
      `,
        )
        .join("")}
    `,
  }));

  await step.inApp("digest-inapp", async () => ({
    subject: `${digest.events.length} new comments`,
    body: `You have ${digest.events.length} new comments on "${payload.postTitle}"`,
  }));
});

How Digests Work

  1. First trigger starts the digest window (e.g., 30 minutes)
  2. Additional triggers within the window are collected
  3. When the window expires, the next step receives all collected events
  4. The notification is sent once with aggregated data

Use Cases

  • Comment notifications — Batch per post
  • Activity summaries — Daily/hourly digests
  • Team updates — Combine multiple changes
  • Alert batching — Group related alerts

On this page