This tutorial covers workspace-level notification templates (
/notifications). For tenant-scoped templates used with the embeddable Courier Create editor, see How to Use the Courier Create API.Prerequisites
- Courier API key
- CLI path: Install the Courier CLI (
npm i -g @trycourier/cli) - MCP path: Add the Courier MCP server to your IDE
Step 1 - List existing templates
Start by seeing what is already on your workspace.results array of templates and a paging object. Note the id of any template you want to inspect further. Courier template ids look like nt_....
Step 2 - Create a draft template
Create a new notification template with Elemental content. The example builds a shipping-update email with a subject line, a text block, and a call-to-action button.id field. Save this as your TEMPLATE_ID.
Step 3 - Inspect the draft
Verify the draft content before publishing. Useretrieve-content --version draft on the CLI; the MCP server has a dedicated get_notification_draft_content tool.
Step 4 - Update the content (optional)
Need to tweak the draft? Useput-content to replace just the Elemental content without touching the template’s name, routing, or other metadata.
Step 5 - Publish
Make the current draft live. Recipients will see this version the next time you send.Step 6 - Verify the published content
Read back the live version to confirm what recipients will see.retrieve-content defaults to the published version. Add --version draft to see the draft. After a publish they will match, but they can differ if you edit the draft without publishing again.Step 7 - Send a test message
Fire a notification using your template. Thedata fields must match the {{variables}} in your Elemental content.
requestId. Check delivery status in Message Logs or by calling courier messages list.
Step 8 - Check version history
See every published version of the template.created_at timestamp and a version string you can use to inspect or publish a specific historical snapshot.
Step 9 - Archive the template
When a template is no longer needed, archive it. Archived templates stop delivering but are not permanently deleted.CLI and MCP coverage
Tips for CI / automation
- Idempotent updates: Use
courier notifications replace --id nt_...(orPUT /notifications/{id}) to overwrite a template by id, making deploys repeatable. - JSON output: Add
--format jsonto any CLI command for machine-parseable output; pipe throughjqfor filtering. - Dry runs with test keys: Use a Test environment API key to iterate without sending real notifications.
- MCP in CI: The MCP server can be called from any MCP-compatible runtime, not just IDEs. Use it in custom automation scripts that support the Model Context Protocol.