Skip to main content
Give users one place to choose which messages they receive, and on which channels. Configure topics once in the editor, then show them to users. Start with the Courier-hosted page, which needs no frontend. Embed the component when the preference center has to live inside your product. Both read and write the same preference data.

Prerequisites

Configure the topics

Use the preferences editor (Platform → Preferences). Topics, sections, and branding are all defined here. Every setting it exposes is in the Preferences Editor reference.
The preferences editor: brand and heading settings and section tabs on the left, with a live preview of the hosted page on the right

The preferences editor: page settings, sections, and topics, with a live preview of the hosted page.

1

Set page settings

Page settings apply to the whole page:
  • An optional brand, for logo and colors.
  • The heading and description.
  • The channel names users see. Rename them to match your product, for example “In-App” to “Inbox”.
2

Add sections

Sections group related topics under a heading you name, such as “Account” or “Marketing”. Turn on channel selection for a section to let users pick which channels deliver its topics.
3

Add topics

Topics are the categories users opt in or out of. For each one, set a name, its section, and a default state:
  • On (OPTED_IN): users receive it unless they opt out.
  • Off (OPTED_OUT): users receive nothing until they opt in.
  • Required (REQUIRED): users can’t opt out. Use it for critical messages, and leave unsubscribe links off templates mapped to required topics.
4

Map templates to topics

Mapping a template to a topic makes Courier enforce the preference on every send. Set it in a template’s settings in Design Studio, or set the template’s subscription field to { "topic_id": "<TOPIC_ID>" } through the API.
5

Publish

Every change saves as a draft. Use Preview Page to open the page in draft mode, then Publish to make it live. Until you publish, users see the last published version.
To batch a topic’s notifications on a schedule, give the topic a digest. See Send a daily digest.

Hosted page

The hosted preference center needs no frontend. It lists the user’s subscription topics with the heading, description, and optional brand you set in the editor. It works on desktop and mobile. Courier serves it at https://view.notificationcenter.app/p/<id>. The id encodes the workspace, brand, and user, so each recipient sees their own preferences.
A branded Courier-hosted preference page with Account Notifications and Marketing sections, per-topic toggles, a Required topic, and a digest delivery schedule

The Courier-hosted preference page a user opens from the preferences link: their subscription topics, grouped into sections and branded.

Link users to their hosted page with the preferences variable. Courier renders it as a secure, per-user URL. Include to.user_id in your send so each recipient gets their own link. Write the variable in the format for your editing context:
  • Content blocks (Text, Markdown, Quote, List): {{$.urls.preferences}}
  • Handlebars (Template blocks, email and brand templates): {{var "urls.preferences"}}
  • Elemental JSON (action buttons and links): {$.urls.preferences}
Put the variable in a saved template, then send that template with the Send API. Below, nt_01kx4h2jdafq8bk9aftxak4b40 is a template whose body includes {{$.urls.preferences}}:
For a one-click opt-out from the topic tied to a message, use the unsubscribe variable the same way ({{$.urls.unsubscribe}}, {{var "urls.unsubscribe"}}, or {$.urls.unsubscribe}).
The URL is empty when the template has no subscription topic, so assign a topic first. On a required topic the opt-out does nothing, so leave unsubscribe links off those templates.
Place either link inside a message, or once in your brand footer so it appears on every message.

One-click unsubscribe headers

Gmail and Yahoo require bulk senders to support one-click unsubscribe. Turn on Unsubscribe Headers for a topic in the preferences editor, or set include_unsubscribe_header on the topic through the API. Courier then adds two headers to that topic’s email:
Both conditions have to hold for the headers to appear. The topic has the setting on, and the message resolves an unsubscribe URL, which means the template is mapped to that topic. Courier adds these headers on SendGrid sends. On another email provider, set them yourself with a provider override.

Embedded component

To keep users inside your product, embed the preference center instead of linking to the hosted page. It reads the same published topics and writes the same preference data, so a change in one place shows up in the other.
The embeddable Courier preferences component, showing a topic section with per-topic toggles and an expanded channel picker for email, push, and SMS

The embedded preference center component: subscription topics with per-topic channel choices.

1

Mint a token with the preferences scopes

Issue the user’s JWT from your backend with POST /auth/issue-token. Add read:preferences write:preferences to the scope string, for example user_id:user_123 read:preferences write:preferences. Without those scopes, the component renders empty.
2

Render the component

Call signIn with the token, then render the preferences component (CourierPreferences in React). Add a preference center has the install command and component for every platform.
To theme the component or build your own preferences UI, see Customize preferences.

Sync changes to your own system

Courier sends each change a user makes in the preference center to your outbound webhooks as a preferences:user:updated event, and records it in the change history. To keep a copy in your CRM or database, see Mirror preferences in another system. The Rails quickstart sends with a subscription topic and links users to this hosted page.

Verify

1

Open the preference center

Open the hosted page from a real send (a message containing {{$.urls.preferences}} with to.user_id set), or load your embedded component as a test user.
2

Toggle a topic off and send

Toggle a topic off. Send a message mapped to that topic and confirm the log shows the send blocked with the reason UNSUBSCRIBED.
3

Read the change back

Read the change back and confirm the status matches what you toggled.