Personalizing Messages
You can personalize the body of your emails with variables that use customer traits or automation trigger properties as inputs. CrowdPower uses Liquid — an open-source template language creating my Shopify — to customize your email body copy for each customer that receives it. In fact, you can use Liquid rules on pretty much any block of copy an automation action uses, including messages in Slack and Discord alerts.
Our email builder, along with some text inputs include a "Variable" dropdown menu that can assist you in adding variables to your copy, but the Liquid template language is actually quite robust. There are a number of things you can do with the language, like add conditionals to your copy, or transform numbers with mathematical formulas.
Filters
Filters take an input value, apply a filter to it, and then return a result. They may also be chained together to transform an input in a number of steps. The following are some examples of filters you can apply to your variables:
capitalize
{{ "hello" | capitalize }}
Hello
date
{{ 1634497325 | date: "%Y" }}
2021
default
{{ "" | default: "Hello" }}
Hello
divided_by
{{ 4 | divided_by: 2 }}
2
downcase
{{ "Hello" | downcase }}
hello
minus
{{ 3 | minus: 2 }}
1
number_to_currency
{{ 100 | number_to_currency: "USD" }}
$1.00
number_to_formatted
{{ 1000 | number_to_formatted }}
1,000
plus
{{ 3 | plus: 2 }}
5
round
{{ 3.6 | round }}
4
strip
{{ " Hello " | strip }}
Hello
times
{{ 3 | times: 2 }}
6
truncate
{{ "Hello" | truncate: 2 }}
He...
upcase
{{ "Hello" | upcase }}
HELLO
Conditionals
You can use if/else conditionals in your body copy. Liquid includes many logical and comparison operators. You can use operators to create logic with control flow tags. For example:
The following are operators you can use in your control flow tags:
==
equals
!=
does not equal
>
greater than
<
less than
>=
greater than or equal to
<=
less than or equal to
or
logical or
and
logical and
Defaults
The default filter sets a default value for any variable with no assigned value. The filter will show its value if the input is nil
, false
, or empty
. It is a good idea to use this filter on all of your variables.
Further Reading
This is just a small sample of the personalization you can accomplish with the Liquid template language. For complete reference, visit the Liquid docs here.
Last updated