SUPPORT.TWILIO.COM END OF LIFE NOTICE: This site, support.twilio.com, is scheduled to go End of Life on February 27, 2024. All Twilio Support content has been migrated to help.twilio.com, where you can continue to find helpful Support articles, API docs, and Twilio blog content, and escalate your issues to our Support team. We encourage you to update your bookmarks and begin using the new site today for all your Twilio Support needs.

Liquid syntax "is" operator outputs unexpected true

Issue

In the Segment workspace, when configuring a destination mapping with Liquid syntax, a conditional statement using the is operator (such as {% if properties.field is 'yes' %}) produces unexpected results. Instead of evaluating exact string matches, the logic returns the true output for any non-null text value present in the field.

 

Product

Twilio Segment

 

Environment

Segment Console

 

Cause

In standard Liquid syntax, is is not a valid comparison operator. Because the operator is not recognized, the Liquid parser defaults to evaluating the "truthiness" of the variable itself. In Liquid, any string that is not empty or null is considered true. Therefore, if the user profile has any text value in that trait field, the if statement evaluates to true and outputs the first condition block.

 

Resolution

To resolve this issue, update the Liquid syntax snippet in your destination mapping to use valid operators based on your desired logic:

  1. Navigate to the destination mapping in the Segment Console where the Liquid syntax is applied.

  2. If your goal is to evaluate an exact string match, replace the is operator with the == operator.

    • Example: {% if properties.field == 'yes' %}

  3. If your goal is to intentionally check if a field has a value (an "is present" check), replace the condition with the != blank operator.

    • Example: {% if properties.field != blank %}

  4. Save the mapping configuration.

 

Additional Information 

Using the blank identifier in Liquid syntax safely checks for both null values and empty strings, making it the most reliable and stable method for creating "is present" or "is not present" conditional logic without relying on parser error-handling.

 

Have more questions? Submit a request
Powered by Zendesk