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.
- Airtable - Connected Content GET request to the Airtable API.
- Flagsmith - Connected Content GET request to the Flagsmith API to get feature flags and remote config.
- Publish a Voucherify incentive to a user in Braze
- Retrieve selected incentive data
- Re-send the same incentive when close to expiration (a reminder)
- Publish another promo code from the same campaign if the previous one was redeemed
- List all unredeemed promo codes for a user in Braze
- List available cart promotions
- Add loyalty points triggered by Braze event
- Update gift card balance triggered by Braze event
- Create a promo code based on the customer's custom attribute
- Transifex - Connected Content GET request to v2.5 of the Transifex API. This API will be deprecated 11/30/2022.
- NASA - Connected Content GET request to NASA's Astronomy Picture of the Day.
- Connected Content GET example
- Connected Content POST example - Connected Content POST request with custom header values.
- Search for a gif on Giphy - Connected Content GET request to Giphy's search endpoint.
- 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).
- Calculate Days Remaining - Get the number of days remaining in the current month.
- 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.
- Random Number - Generate a random number.