Skip to content

Liquid templates

Youtube Video: Learn how to use content templates in Customer journeys

Liquid templates significantly broaden Pushwoosh’s personalization capabilities by implementing sophisticated logic in addition to regular Dynamic Content usage.

Message personalization in Pushwoosh is based on Tags (user data). Pushwoosh offers a variety of default Tags and custom Tags. Using them, you can specify a user’s first name, city, purchase history, etc. to send a more personalized message. For example: Hi {{First_name}}, thanks for ordering {{item}}.

Liquid templates add more logic to dynamic content. For instance, if a user’s subscription tag contains “free,” you can send them a message: “Grab your 10% discount.”

Modifying the message content according to users’ IDs, behaviors, and preferences is the most efficient way to increase relevance and get more impressive results from your marketing campaigns.

Content templates based on Liquid by Shopify use a combination of tags, objects, and filters to load dynamic content. Content templates allow you to access certain variables from within a template and output their data without having to know anything about the data itself.

objects define the content that will be displayed to a user. objects should be enclosed in double curly braces: {{ }}

For example, when personalizing a message, send {{Name}} in its body to add the users’ names to the message’s content. The user’s name (Name tag value) will replace the Liquid object in a message the user will see.

Hi {{Name}}! We're glad you're back!

To insert the recipient’s User ID, write {{userid}} in lowercase. Variable names are case-sensitive, so {{user_id}} and {{UserId}} are unknown names and render as empty text.

If a recipient has no User ID, {{userid}} also renders as empty text and the message is still sent. To show a fallback instead, add the default filter: {{userid | default: "friend"}}.

tags create the logic and control flow for templates. The curly brace percentage delimiters {% and %} and the text that they surround do not produce any visible output when the template is rendered. This lets you assign variables and create conditions or loops without showing any of the Liquid logic to a user.

For example, using the if tag, you can vary the message’s language based on what language is set on user’s device:

{% if Language == 'fr' %}
Salut!
{% else %}
Hello!
{% endif %}

Tags operators

Anchor link to
OperatorDescription
==equals
!=does not equal
>greater than
<less than
>=greater than or equal to
<=less than or equal to
orlogical or
andlogical and
containschecks for the presence of a substring inside a string or array of strings

filters modify the output of a Liquid object or variable. They are used within double curly braces {{ }} and variable assignment, and are separated by a pipe character |. Multiple filters can be used on one output, and are applied from left to right.

{{ Name | capitalize | prepend:"Hello " }}

Liquid templates usage

Anchor link to

Liquid templates are available for both messages sent from Control Panel and API requests.

In Pushwoosh, Liquid templates are applicable to all content fields of any channel message:

  • Push notifications
  • Emails
  • In-app rich media shown by a journey, once Liquid in in-apps is enabled for your account

To add a Liquid Template to your message, insert it into the message’s body. You can do it when working with push or email elements, directly from the Customer Journey Builder interface.

For in-apps, write Liquid in the in-app content itself. See Liquid in in-apps.

To add data from your own backend to a push or email, such as a promo code or product recommendations, use Connected content.

Go to Customer Journey Builder > Create Campaign > drag and drop the following elements to your canvas: Audience-based Entry, Push (or Email), and Exit. Connect the elements. Then click the Push icon, choose Custom content, and insert your copy.

To add Liquid logic, use tag values with the following syntax:

{% if TagName == 'value' %}
Content to send in this scenario
{% else %}
Content to send otherwise
{% endif %}

Then click Apply.

Write Tag names without spaces. For a Tag named My Tag, write {{MyTag}}. Other characters stay as they are, so for the Tag my_tag write {{my_tag}}.

Learn more about Liquid templates in journeys