# Add Dynamic Content To Messages

#### Note

Mixpanel templating described in the following article will be deprecated by December 2020. You can liquid templating as an alternative to Mixpanel templating.

Deliver personalized messages to your users by adding properties stored in user profiles to your Mixpanel messages. You can use any user profile property in your project to add customization to your email, in-app and push notifications.

You should test your messages when using dynamic content before sending to your users, in order to ensure that they are working as intended.

Mixpanel also offers Liquid Templating in Email, Push, and SMS messages.

## Add Variables to Email, In-App, & Push Notifications

To customize your messages with a user profile property, simply type two curly brackets into your message:

{{

From there, you can select a property to add from the dropdown (closing brackets will automatically be added). The Mixpanel default properties will appear first, but you can start typing the names of other properties as well, and they will appear in the dropdown. If the property does not populate in the dropdown, you can add the variable using the syntax below.

You can also add dynamic properties into the URL of in-app messages.

When Mixpanel delivers the message, the variable will be replaced with the value of that property in the user’s profile:

Variables look like this:

{{ ${property} }} Here's an example that adds a first name ($first_name) as a variable:
{{$first_name}} End user view: Your last order was January 10! Come back and get 15% off. Your view: Your last order was {{${date of last order} }}! Come back and get 15% off.

Note that every { needs a } in order to close the variable.

### Reserved Properties

The syntax to include a reserved property is slightly different than the syntax to include a regular user profile property:
{{${$reserved_property}}}
The actual name the reserved property is being recorded as must be used in the syntax (i.e. $email or$name).

## Fallback Values

If not all your profiles have the same properties, you’ll want to provide a fallback value so that messages for users without a certain property don’t arrive blank or broken:

{{${property}|fallback:"default value"}} For example: {{${date of last order}|fallback:"a long time ago"}}

If the person doesn’t have a date of last order property value, their message will look like this:

Your last order was a long time ago! Come back and get 15% off.

## Advanced Customization - Conditional Blocks

If fallback values aren’t enough to accomplish the message you want to send, you can use conditional blocks:

{% if ${property} %} Will appear if property is present. {% else %} Will appear if property is absent. {% endif %} End user view for users with a preferred office location set: Come and visit us at our Asheville office. End user view if without a preferred office location set: You haven't told us your location. Please update your location in your account, and we'll send you to our nearest office. Your view: {% if${Office Location} %}

Come and visit us at our {{ ${Office Location} }} office. {% else %} You haven't told us your location. Please update your location in your account, and we'll send you to our nearest office. {% endif %} If you want a value to appear only if the property exists on the user’s profile, you can exclude the {%else%} tag from your conditional block. In this example, anyone without a Visit Count property will receive only “Thanks for coming by!”: Thanks for coming by! {% if${Visit Count} %}

You have visited {{ \${Visit Count} }} times.

{% endif %}

It is important to note that conditional blocks can only show the value of a property itself and cannot be configured to send different messages based on that value.

For example, it is not possible to use conditional blocks to send Message A if the value of the "Visit count" property is greater than 10 and Message B if the value of the "'Visit count" property is less than 10. Instead, If this is your goal, you should set up messages with different targeting as opposed to trying to use logic within a single message.

Mixpanel will cease reading for dynamic properties if there are two curly brackets ‘{{‘ anywhere in a message that are not part of a dynamic property. This can cause dynamic properties to not work as intended, and the variable name of the dynamic property will send instead of the actual value of the dynamic property.