Liquid Template Language in Workflows
Sana Commerce Cloud uses the Liquid template language to dynamically populate values in workflow fields at runtime. Liquid lets you insert data from your webstore, such as customer names, e-mail addresses, basket totals, or order IDs, directly into e-mails, HTTP request bodies, Google Sheets column values, condition criteria, and other configurable fields.
Where You Can Use Liquid
Liquid expressions are supported in the following fields across workflow actions:
- Send email - To: Dynamically address e-mails to individual customers.
- Send email - Subject: Include dynamic data such as order numbers.
- Send email - Body: Personalize the message with customer names, basket details, etc.
- Send HTTP request - URL: Build dynamic request URLs.
- Send HTTP request - Headers: Inject dynamic header values such as authentication tokens from secrets.
- Send HTTP request - Body: Send dynamic data to external APIs.
- Google Sheets - Append row - Column Values: Populate sheet columns with webstore data.
Basic Syntax
Liquid variables are enclosed in double curly braces:
{{variable_name}}
In workflows, variables follow a path structure that reflects the data hierarchy. For example:
{{basketsForEachItem.shopAccount.email}}
{{basketsForEachItem.shopAccount.name}}
{{basketsForEachItem.total}}
{{basketsForEachItem.currencyId}}
Using Secrets with Liquid
Secrets are referenced in workflow fields using the following syntax:
{{secrets.your_secret_key}}
For example, if you have a secret with the API key, you would reference it as:
{{secrets.ApiKey}}
Using Liquid in E-Mail Bodies
The e-mail body field supports HTML alongside Liquid. This allows you to send well-formatted, personalized messages. For example:
<p>Dear {{basketsForEachItem.shopAccount.name}},</p>
<p> You have items in your shopping basket that have been pending checkout for some days. Your cart total is {{basketsForEachItem.total}}<p>
<p> Completing your checkout will help ensure timely order fulfillment.</p>
Liquid variables are resolved using real webstore data at the time the workflow runs.