Template Block
Availability: Email only
The Template Block allows you to use Handlebars templates along with html and css to add customized content to your notifications.
The Template Block presents you with an html editor containing a div and style element. Starting with these elements, you can build out the look and feel of the block content. Note: HTML and CSS support varies by email client.
Handlebars Templating Language
The Template Block supports Handlebars. You can learn about the language syntax from the Handlebars Language Guide.
Read More: Courier custom Handlebars helpers
Example
1. Using the Notification Designer, add a Template Block to an Email notification.
2. Open the Preview tab and create a test event providing the data values for the Template Block.
3. Select that test event in the Preview to see the code rendered in the email.
Using Markdown in a Template Block
If you like to compose in markdown, you can do that using the Template Block. Just add a Template Block to your notification, add the following code:
<div>{{#markdown}} YOUR MARKDOWN GOES HERE {{/markdown}}</div>
Then write in your markdown between the {{#markdown}}
and {{/markdown}}
.
Using replacement variables in Handlbars
To insert a variable from your JSON event, you need the variable handlebars helper
{{var "variable_name"}}
Read more
Inserting HTML into a Handlebars block
To safely pull in a data object variable containing HTML, surround the variable with three curly brackets {{{variable}}}