Using merge fields to personalise messages and customer journeys

Angel Cheung
Angel Cheung
  • Updated

Merge fields are a powerful tool to personalise your communications and customer journeys, using either the customer data from your systems of record, or from external systems (Weather services, traffic services etc).

In this article, you’ll learn about merge fields and ways you can use them to personalise messages and customer journeys.

Quick links

What are merge fields?

Using merge fields in flows

Using merge fields with the character count

Using merge fields with arrays

Using merge fields with a blank or non-existent value

(Advanced) Conditional logic


 

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 bold, teal appearance, like this: firstName

For instance, to personalise a message using the customer's first name, your message could use the merge field: firstName. When a flow is live, the merge field references all the data stored against the corresponding firstName field in your systems, which is retrieved by a prior node in your flow. The recipient would receive a message with the merge field replaced with their info:

firstName.png


Using merge fields in flows

You can view merge fields available to reference via the merge field pop up, or the merge field tab. You can either search, or traverse prior nodes to find the merge field you want to reference. Once found, simply click to either insert (in the merge field pop up) or copy to clipboard (in the merge field tab).

Important considerations when viewing available merge fields:

  1. 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.
  2. You can only select merge fields from nodes if they have outputs and are on the 'common path' on the current node.

Merge field pop up

merge fields.png

The merge field pop up is a handy way to search and insert merge fields straight into an input field. It also easily lets you know whether you can use a merge field in that particular field.

How to use the merge field pop up

  1. Click the merge field button. A search bar will appear.
  2. Type a value in the search bar. The value will only be searched against the path of the merge field itself, not the description nor example.
  3. Click the merge field you want to use to insert it. And voila!

Merge field tab: Quick search

Tab_option2.png

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

  1. Type a value in the search bar. The value will only be searched against the merge field itself, not the description nor example.
  2. Click to copy the merge field to your clipboard, and paste in the desired field

Merge field tab: Explorer

Tab_option.png

The merge field explorer displays merge fields that can be referenced from nodes previous to this node.

How to use the merge field explorer

  1. 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.
  2. Click through the levels of data to select from, as indicated by mceclip3.png. The merge field is indicated by mceclip4.png.
  3. 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.

Merge fields affect character count

The character count in the message body will not accurately reflect the rendered version of the merge fields.  For example, 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 item in the 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.

(Advanced) 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.

mceclip0.png

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 unlesshelper as the opposite of the ifhelper. 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.

 

 

Related to