Skip to main content
Courier Elemental lets you define notification content as JSON instead of using the visual template designer. This is useful when your content is generated dynamically, managed in code, or needs to differ per channel. This tutorial walks through building a real notification end-to-end: starting with a simple message, then layering in channel-specific content, conditional rendering, and dynamic lists.

Prerequisites

Send a Simple Elemental Message

The fastest way to use Elemental is the sugar syntax: just title and body. Courier automatically converts this into the full Elemental format behind the scenes.
1

Send with title and body

This sends an email with the subject “Your order has shipped” and the body text populated with your template variables. No stored template required.
2

Verify delivery

Check the Message Logs in the Courier dashboard to confirm the message was delivered and see the rendered output.
The sugar syntax is ideal for simple messages. For multi-element layouts, channel-specific content, or dynamic logic, use the full Elemental format below.

Use Full Elemental Format

Full Elemental gives you complete control over the notification structure. Every template requires a version field ("2022-01-01") and an elements array.
1

Build a structured notification

This example creates an order confirmation with a heading, body text, and a call-to-action button.

Element Types at a Glance

For full property details, see the Elements Reference.

Customize Content Per Channel

Use channel elements to send different content to different channels from a single API call. This is one of Elemental’s most powerful features.
You can also use the channels property on individual elements to show or hide them by channel without wrapping in a channel block:

Add Conditional Logic

Use the if property on any element to conditionally render it based on your data.
The if expression is evaluated as JavaScript against the data object you pass in the send call.

Render Dynamic Lists

The loop property iterates over an array in your data and renders the element once per item.
Inside a loop, {{$.item}} refers to the current item and {{$.index}} gives the zero-based index.
The format property on text elements supports "markdown" for bold, italic, and link rendering. Use double asterisks (**bold**) or single asterisks (*italic*) in your content strings.

Send to a Stored User Profile

Instead of specifying an email address directly, you can send to a user by their profile ID. Courier looks up their contact details from the stored profile.