{
  "slug": "weekly-digest-email",
  "title": "Weekly digest email: template and code",
  "url": "https://www.courier.com/recipes/weekly-digest-email",
  "markdown": "https://www.courier.com/recipes/weekly-digest-email.md",
  "stage": "Engagement",
  "purpose": "Send one weekly summary instead of a dozen separate pings.",
  "summary": "A weekly digest email collects a user's activity into one summary instead of an email for every event. Each event is added as it happens, and every Monday at 9:00 one email goes out with the total count and the latest 20 events. Anyone who turns the digest off stops getting it.",
  "channels": [
    "email"
  ],
  "shape": "journey",
  "shows": [
    "A Send to Digest node fed by your events",
    "A digest topic and schedule created over the API",
    "Releasing one user's digest early"
  ],
  "data": [
    {
      "name": "actor_name",
      "type": "string",
      "example": "Sam",
      "note": "Who did it"
    },
    {
      "name": "action",
      "type": "string",
      "example": "commented on"
    },
    {
      "name": "target_name",
      "type": "string",
      "example": "Q4 plan"
    },
    {
      "name": "digest.count",
      "type": "number",
      "example": "3",
      "note": "Set by Courier when the digest releases"
    }
  ],
  "steps": [
    {
      "step": "1",
      "when": "Each time something happens",
      "channels": "None, the event is held",
      "templates": []
    },
    {
      "step": "2",
      "when": "Every Monday at 9:00, New York time",
      "channels": "Email",
      "templates": [
        "templates/weekly-digest-email.json"
      ]
    }
  ],
  "files": {
    "journey": "journey.json",
    "templates": [
      "templates/weekly-digest-email.json"
    ],
    "setup": [
      "setup.ts",
      "setup-digest.ts"
    ],
    "start": [
      "start.ts",
      "start.py"
    ],
    "stop": [
      "stop.ts",
      "stop.py"
    ]
  },
  "docs": [
    "https://www.courier.com/docs/journeys/nodes/digest",
    "https://www.courier.com/docs/guides/send-a-daily-digest",
    "https://www.courier.com/docs/api-reference/preference-topics/create-topic-in-section",
    "https://www.courier.com/docs/api-reference/digests/release-a-recipients-digest",
    "https://www.courier.com/docs/guides/build-a-preference-center",
    "https://www.courier.com/docs/journeys/invoke"
  ],
  "related_recipes": [
    "https://www.courier.com/recipes/comment-notification-batching",
    "https://www.courier.com/recipes/usage-limit-alert-email",
    "https://www.courier.com/recipes/nps-survey-email"
  ],
  "agent_prompt": "Add a weekly activity digest to this app, sent through Courier: collect each activity event for a user and send one summary email every Monday instead of an email per event. Follow the steps at https://www.courier.com/recipes/weekly-digest-email.md and use the Courier skill for SDK details.\n\n1. Create the journey and its digest template in my Courier workspace by running the setup command from that page, with COURIER_API_KEY from our environment. Save the IDs it prints as COURIER_DIGEST_JOURNEY_ID, COURIER_DIGEST_SECTION_ID, and COURIER_DIGEST_TOPIC_ID.\n2. Find where this codebase records activity a user should hear about, like comments, assignments, and mentions, and add each event to the digest there. Pass the fields in the Data fields table from our own data.\n3. Find where a user turns off email summaries and opt them out with stopWeeklyDigest.\n4. Match this codebase's language, file layout, and error handling. Never hardcode the API key.\n5. When you're done, add three events for a test user, release their digest with sendWeeklyDigestNow, and show me the email it sent.",
  "status": {
    "state": "passing",
    "last_tested": "2026-10-19"
  }
}
