Skip to content

Aborting Liquid messages

Optionally, you can also abort messages within conditionals. Here are some examples of how this feature can be used in marketing campaigns:

Abort message if “Number Games Attended” = 0

For example, let’s say that you did not want to send a message to customers who have not attended a game:

1
2
3
4
5
6
7
{% if customer_attribute.${Number_Game_Attended} == 1 %}
Loved the game? Get 10% off your second one with code SAVE10.
{% elsif customer_attribute.${Number_Game Attended} > 1 %}
Love the games? Get 10% off your next one with code SAVE10.
{% else %}
{% abort_message() %}
{% endif %}

This message will only send to customers who are known to have attended a game.

Message English speaking customers only

You can message English speaking customers only by creating an “if” statement that’ll match when a customer’s language is English and an else statement that’ll abort the message for anyone who does not speak English or does not have a language on their profile.

1
2
3
4
5
6
{% if ${language} == 'en' %}
Send this message in English!
{% else %}
{% abort_message() %}
{% endif %}

By default Braze will log a generic error message to your Developer Console log:

1
{% abort_message %} called

You can also have the abort message log something to your Developer Console log by including a string inside the parentheses:

1
{% abort_message('language was nil') %}

Message error log in the Developer Console with an abort message of "language was nil".

WAS THIS PAGE HELPFUL?
New Stuff!