Retention

Weekly digest email workflow

A summary email every Monday morning in each user’s time zone, built as a short journey that ends by emitting the event that starts next week’s.

Emailtrigger.eventdelaytimeWindowsendEventexitWhenreentry: concurrentcooldown
import { eq, trigger, workflow } from 'sendwend';
import { e, u } from './contract';
import { email } from './templates';

/**
 * Weekly digest: every Monday morning in the user's time zone, a
 * summary of their workspace. There is no loop inside a workflow: each
 * week is one short journey that ends by emitting the event that starts
 * the next one. The app sends the first `digest_due` when the user
 * turns the digest on.
 *
 * `concurrent`, because the next week's `digest_due` arrives while this
 * journey is still running (it is the last step): `after_exit` would
 * drop it. The 6-day cooldown is the backstop that keeps a stray extra
 * event from starting a second weekly cycle. `exitWhen` ends the cycle
 * for good once the user switches the digest off; an opted-out topic
 * alone would only skip the send.
 */
export const weeklyDigest = workflow({
  id: 'weekly_digest',
  name: 'Weekly digest',
  trigger: trigger.event(e.digest_due),
  reentry: { mode: 'concurrent', cooldown: '6 days' },
  exitWhen: eq(u.digest_enabled, false),
})
  .timeWindow({ days: ['mon'], between: ['08:00', '10:00'] })
  .email(email.weeklyDigest, { name: u.name })
  .delay('6 days')
  .sendEvent(e.digest_due);
Compiled canvasDrag to pan

When to use it

For products where activity happens while the user is away: comments, edits by teammates, new results. A digest gives them a reason to come back on a predictable day without a notification for every change.

How it works

  1. 1A digest_due event starts a journey. The app sends the first one when the user turns the digest on.
  2. 2timeWindow holds until Monday between 08:00 and 10:00 in the user’s time zone.
  3. 3The digest email goes out.
  4. 4Six days later, sendEvent(e.digest_due) emits the event that starts next week’s journey, and this one ends.
  5. 5If the user switches the digest off (digest_enabled false), exitWhen ends the current journey and the cycle stops.

Why it's built this way

No loop: an event edge

A workflow is a tree; it cannot jump back. Each week is its own short journey, and the last step emits the trigger of the next. Every week is then a separate instance with its own history.

Why concurrent

The next digest_due is emitted by the last step, while this journey still runs. Under after_exit it would be dropped, and under never the cycle would stop after one week. concurrent lets it in.

The cooldown is the backstop

With concurrent, a stray extra digest_due (the app sending it twice, say) could start a second weekly cycle. A 6-day cooldown from the previous entry refuses it; the journey’s own event always arrives after six days.

exitWhen stops the cycle

Opting out of the digest topic skips the email, but the weekly journeys would keep running. exitWhen on the profile flag ends them.

Make it yours

  • Pick another day and hour in the timeWindow; it is in the user’s time zone by default.
  • Make it fortnightly with a 13-day delay and cooldown.
  • Skip a week with nothing to report: a branch on recent activity before the email.
  • Start the cycle from another workflow’s last step instead of from the app.

What to measure

Sessions on Mondays from digest recipients, and digest unsubscribes.

Also see Onboarding education drip campaign.