Merge fields are a powerful tool to personalise your communications and customer journeys, using the customer data from your system of record.
In this article, you’ll learn about merge fields and ways you can use them to personalise messages and customer journeys.
Quick links
Using merge fields with the character count
Using merge fields with arrays
Using merge fields with a blank or non-existent value
What are merge fields?
Merge fields are dynamic values that are replaced with the recipient-specific value when a flow goes live. The recipient-specific value is determined by the data brought into the flow. A merge field can be identified through its two curly braces: {{example.firstName}}
.
For instance, to personalise a message using the customer's first name, your message could use the merge field: {{webhookTrigger.firstName}}
. When a flow is live, the merge field references all the data stored against firstName
within your database, which is retrieved by the trigger node of your flow. The recipient would receive a message with the merge field rendered:
Using mergefields in flows
View merge fields available to be referenced in the merge field pop up or the merge field tab (node modal). These merge field viewers are an easy to configure and fill in the fields required within the node you are configuring.
Important considerations when viewing available merge fields:
- Each node will only display merge fields generated by previous nodes along the same branch. You cannot reference merge fields from a node on a separate branch.
- You can only select merge fields from nodes if they have outputs and are on the 'common path' on the current node.
Mergefield tab: Quick search
The search bar is a way to quickly search for the exact merge field you want to use. The results displayed are merge fields from nodes previous to this node.
How to use the search bar
- Type a value in the search bar. The value will only be searched against the merge field itself, not the description nor example.
- Click to copy the merge field to your clipboard, and paste in the desired field
Mergefield tab: Explorer
The merge field explorer displays merge fields that can be referenced from nodes previous to this node.
How to use the merge field explorer
- In the first column, click on a node item to view the merge fields within. This column displays all the nodes you can copy merge fields from, in respect to this node's position in the flow.
- Click through the levels of data to select from, as indicated by
. The merge field is indicated by
.
- Click to copy the merge field to your clipboard, and paste into desired field within the node's configuration settings.
Important notes to consider
Merge fields are not limited to message bodies. They can also be used in other fields across the flow builder, such as criteria split fields and recipient fields.
Using merge fields with the character count
The character count in the message body will not accurately reflect the rendered version of the merge fields. For example, {{webhookTrigger_1.firstName}}
can render as Lam
(3 characters) or Maddie
(6 characters).
Using merge fields with arrays
When using merge fields with arrays, Pendula currently defaults to rendering the first array retrieved.
Use merge fields with arrays with caution, as you can't guarantee the array index exists in the database.
Using merge fields with a blank or non-existent value
If a merge field value is blank or non-existent in your data extension, it will simply render blank in the message to the recipient.
Conditional logic
Merge fields operates on the simple templating language called Handlebars. This system supports conditional logic, meaning you can display certain blocks of information depending on if certain criteria are met.
For example, Cody, who had a timestamp against his visit, would receive a different message to Betty, who didn't.
For instances where more complex conditional logic is required, we recommend using the criteria split node instead.
If-else {{#if}}
If-else statements let you conditionally render blocks based on if-else logic arguments; if this, then do this. The {{#if}}
block argument checks whether a value exists in the block, as opposed to a return of false
, undefined
, null
, “”
, 0
or {}
.
Hey {{firstName}},
Thanks for your recent visit at Acme
{{#if webhookTrigger.date}}
on {{webhookTrigger.date}}
{{/if}}.
How did we go?
You can also use {{else}}
inside of {{#if}}
statements to determine what block will render if the initial{{#if}}
block returns a false value.
Hey {{firstName}},
Thanks for your recent visit at Acme
{{#if webhookTrigger.date}}
on {{webhookTrigger.date}}
{{else}}
with our team
{{/if}}.
How did we go?
The example above would render differently if the date stamp was recorded or not.
Unless {{#unless}}
You can use the unless
helper as the opposite of the if
helper. Its block will likewise be rendered if the expression returns a false
, undefined
, null
, “”
, 0
or {}
.
Read more about how conditional logic works with Handlebars.