Template variables

RCS Studio uses LiquidJS to make your messages dynamic. Any string input field in the builder supports Liquid syntax, including message text, card titles, descriptions, button labels, URLs, and more.

There are several types of variables available depending on how your agent is configured:

VariableWhat it gives youExample
paramsParameters you pass in via the API or postback data{{ params.firstName }}
dataResults from connector operations{{ data.orderLookup.status }}
messageThe user's most recent message or action{{ message.text }}
inputValues captured from input assignments{{ input.name }}
userInformation about the end user{{ user.msisdn }}

params

These are parameters you provide, either through an API request body or from a user's button tap postback data. They're the most common way to inject dynamic content into your templates.

Hello {{ params.firstName }}!

Your order #{{ params.orderId }} is {{ params.status }}.

You can also pass nested objects and access them with dot notation:

{{ params.address.city }}, {{ params.address.state }}

data

When your agent uses connectors to fetch external data (like looking up an order or calling a weather API), the results are stored in data under the context key you configure in the operation.

{% if data.orderLookup.status == "shipped" %}
  Your order shipped on {{ data.orderLookup.shipDate | date_format: "MMMM D, YYYY" }}.
{% else %}
  Your order is being prepared.
{% endif %}

message

This gives you access to whatever the user just sent, whether they typed a message, tapped a button, shared their location, or sent a file.

FieldWhat it contains
message.textWhat the user typed, or the label of the button they tapped
message.location.latitudeLatitude if the user shared their location
message.location.longitudeLongitude if the user shared their location
message.fileFile metadata if the user sent a file
You said: {{ message.text }}

input

When you configure input assignments, the captured values are available under input using the field name you specified in the To field.

For example, if you assign the user's text to name, it's available as:

Hello {{ input.name }}!

See Assigning Inputs for how to set up input assignments.


user

Information about the end user interacting with your agent.

FieldWhat it contains
user.msisdnThe user's phone number in E.164 format (e.g. +15551234567)

Examples

Personalized greeting

Hi {{ params.firstName }}, welcome to {{ params.brandName }}!

Conditional content based on connector data

{% if data.weather.temp > 80 %}
  It's {{ data.weather.temp }}°F — stay cool!
{% else %}
  It's {{ data.weather.temp }}°F — have a great day!
{% endif %}

Echoing the user's message

You said: {{ message.text }}. Let me look that up for you.

Using a captured input

Got it! We'll send updates to {{ input.email }}.