> ## Documentation Index
> Fetch the complete documentation index at: https://www.courier.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Install the Courier skill before writing code: `npx skills add trycourier/courier-skills`. It carries the verified SDK shapes and the rules you cannot get wrong.
> Authenticate every request with `Authorization: Bearer <API_KEY>`. A workspace has several environments and each has its own keys, which are plain `pk_` strings with no environment prefix. Start with Test.
> Send with `client.send.message`, the default import of the v7 Node SDK. Reference a template by its `nt_` id or its alias.
> A send accepts a bare Elemental element list, but storing content on a template requires the top-level elements wrapped in a channel element.
> Templates and journeys can be built in the Courier app or created through the API. Either way they live in the workspace and are referenced by ID when you send.
> The hosted MCP server is https://mcp.courier.com. For a briefing on what Courier is and when to use it, read https://www.courier.com/llms.txt.
> Prefer the Guides tab for how-do-I questions and the Docs tab for how-does-it-behave questions. The API reference lives under /api-reference.

# Journey digest node

> Add the run's event to a subscription topic's digest, released on the user's schedule.

export const AppLink = ({href, children, name, bare}) => {
  const label = children || name || "Open in Courier";
  if (bare) {
    return <a href={href} target="_blank" rel="noreferrer">{label}</a>;
  }
  return <a className="cx-endpoint" data-kind="app" href={href} target="_blank" rel="noreferrer">
      <span className="cx-endpoint-label">{label}</span>
      <span className="cx-endpoint-method" aria-hidden="true">↗</span>
    </a>;
};

export const Doc = ({href, children, name, bare}) => {
  const label = children || name || href;
  if (bare) {
    return <a href={href}>{label}</a>;
  }
  return <a className="cx-endpoint" data-kind="doc" href={href}>
      <span className="cx-endpoint-label">{label}</span>
      <span className="cx-endpoint-method">DOC</span>
    </a>;
};

The Send to Digest node adds the current event to a digest owned by a subscription topic. Events accumulate per user and release on that topic's schedule.

Use it for periodic summaries, a daily activity email or a weekly report, instead of one notification per event.

Use Send to Digest when releases should follow a fixed schedule that the user controls. Use the <Doc href="/docs/journeys/nodes/batch">Batch node</Doc> to release based on volume or an inactivity window within the journey itself.

## Configuration

| Field                  | Description                                                                                                                                                       |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Subscription topic** | Required. The subscription topic that owns the digest the event is added to. Events accumulate per user, identified by `user_id` (or `userId`) in the event data. |
| **Conditions**         | Optional. Only add the event to the digest when the conditions evaluate true.                                                                                     |

## Configure the digest on the topic

The schedule, categories, retention, and template mapping live on the subscription topic, not on the node. Configure them in the <AppLink href="https://app.courier.com/~/test/platform/preferences">Preferences Editor</AppLink> (**Platform → Preferences**):

* **Schedule**: when the digest releases (at least one schedule is required, multiple appear as choices on the hosted preferences page).
* **Categories**: separate types of data within one digest, each with its own retention (First, Last, Highest, or Lowest N, where Highest and Lowest need a sort key).
* **Template mapping**: the notification template that renders the released digest.

The Send to Digest node only collects. Releases happen when the topic's schedule fires.

## Digest payload

When the digest releases, each category is delivered with the total `count` and the retained `items`:

```json theme={null}
{
  "[category_key]": {
    "count": 15,
    "items": [
      { "event": "data", "from": "first_event" },
      { "event": "data", "from": "second_event" }
    ]
  }
}
```

`count` is the total number of events received (it can exceed the retained count). `items` are the retained events. Reference this data in your digest template.

## Via the API

In a journey definition, a Send to Digest node uses `type: "add-to-digest"`:

```json theme={null}
{
  "type": "add-to-digest",
  "subscription_topic_id": "your-topic-id"
}
```

See <Doc href="/docs/journeys/build">Building Journeys via the API</Doc> for the full node reference.
