A collection of helpful Liquid code snippets compiled by Notable Growth. These snippets are intended for use with Braze.
As Braze uses a forked version of Liquid, the code in these snippets may not work with other services that also use Liquid.
Notable Growth is a Braze Alloy partner, we use data, creativity, and empathy in our strategic planning to connect meaningfully with our customers and deliver Notable results.
- Create Array - Create an array from a string. This also has an example of how to count values in a for loop.
- Create Two Dimensional Array - Create a two dimensional array.
- For Loop Multiple Arrays - Looping through one array while referencing another array.
- Connected Content Get - Connected Content GET request with basic auth.
- Connected Content Post - Connected Content POST request with custom header values.
- Connected Content Airtable - Connected Content GET request to the Airtable API.
- Connected Content Flagsmith - Connected Content GET request to the Flagsmith API to get feature flags and remote config.
- Connected Content Transifex - Connected Content GET request to v2.5 of the Transifex API. This API will be deprecated 11/30/2022.
- Add Days - Add a specific amount of days to an existing date. Starting date must be converted to seconds first.
- Format Date - Format a date into ISO 8601.
- Ordinal Date - Get the ordinal number for a date (e.g 5th, 22nd etc).
- Abort - Abort a campaign based on the value of a variable.
- Case When - Switch statement based on the values of a variable. Useful for displaying copy based on the language of a user.
- Compare Negative Numbers - Simple example showing how to handle comparing a negative number in Liquid. This also has an example of casting a string as a number.