Personalized Text in Mobile Messages

Templating allows you to efficiently personalize messages for users. You can insert any User Attribute into a message–for example, their name or status–and the current value of the attribute for each user will be displayed when the user receives the message. Templating can be used in the title and body of In-App Messages and in Push Notifications.

Note: When personalizing a Lifecycle Optimizer push notification, use Zephyr.

Templates employ the use of double curly braces ('{{', '}}') to signify when an attribute is used.

Here’s a simple example of how to greet a user by name:

Input: "Hello, {{ custom.user_first_name }}!"

This simple template would look for a user attribute with the key ‘user_first_name’ and then on a user-by-user basis, would replace it with the value (their name). This includes the double curly braces.

Output: “Hello, Sam!”

If they don’t have a value set, then you can use a default value.

Input: "Hello {{ custom.first_name | default:'there'}}!"

Output:“Hello there!”

This also applies to text, numbers and dates too.

Input: "Hey {{ custom.first_name | default:'there'}}. We see you've purchased {{custom.total_purchases}} products so far, with the latest being {{custom.latest_purchased}}. How are you finding them? Please fill out [this survey]( to tell us more!</span>

Output: “Hey Sam. We see you’ve purchased 9 products so far, with the latest being 5/5/2015. How are you finding them? Please fill out this survey to tell us more!”

For in-app messages, we support even more of the Liquid Templating Language, so there’s many more advanced techniques you can use such as conditional text, math, and iteration.