Render Template

The Render Template Step is used to insert variable data into predefined text, similar to the way that mail-merge works in a word processor. This step can be used to insert boilerplate text using information that comes from a different step (or steps) earlier in the Journey.

Anytime there are more than 2 outputs being used to create an input for another step, consider using a Render Template in order to provide better control of the text and a friendlier interface.

Inputs

Template

Users can enter boilerplate text along with additional markup that defines how and where to insert variable data into the Template input. The template rendering engine that Y Meadows uses is called Mustache after the shape of the { character that is used to set variables apart from boilerplate.

Instead of describing the full function of Mustache here, visit tsmean.com for a tutorial to get started. More advanced information can be found easily with an online search. In fact, the full Mustache specifications are available on their main site. Basically, users will name their outputs and then insert them into boilerplate text using {{{outputName}}}, but there are a lot of other options to explore as well!

Since Mustache's template language is designed for use on the web, it can sometimes perform in ways that are not expected because it uses HTML escaping for all inserted variables by default. In other words, if a user tries to insert a variable with a double quote (") in it, they will receive " in the output. This is the behavior if users use the most common {{ }} syntax for variable insertion.

Users will want to use the triple mustache syntax {{{variable name}}} to provide them with the text they are expecting.

However, when using Mustache's version of conditional logic to show or hide content based on variable data, only two curly braces can be used. If logic is encased in 3 braces, the logic will fail to be executed correctly.

Template Variables

Template Variables are accessed via a tab at the top of the input window or by clicking on the Template Variables section in the right hand sidebar. The “Names'' on the left go inside the {{}} in a template, while data from the “Values'' on the right are inserted into the text when the Journey is run. For example, {{PreviousSubject}} can be used to insert the value from the subject of the incoming message into some boilerplate text. Notice that the values can be made up of standard expressions allowing for any manipulation of the data to happen before it is inserted into the template such as changing the case of some text or calculating a value.

Outputs

rendered_template

After inserting variable data into the template, the resulting text will be available for use by subsequent steps in the “rendered_template” output from this step. This is a great way to create email messages, status updates, etc. in an easy, consistent way.

Last updated