Assistant Variables

When creating assistants, you may want to customize parts of your prompt with variables. You can use variable replacements in the goal, the persona, the instructions and the user description. 

Currently there are four categories of variables: user, attributes data, and metadata

Variables are always referenced using double curly braces, and should include the variable category along with a period, like this: 

{{user.name}} or {{attributes.my_attribute}}

IMPORTANT: Assistant variables are case sensitive, which means the names have to match EXACTLY. {{metadata.hostUrl}} is NOT the same as {{metadata.hosturl}} so make sure you are careful when specifying your variables.

Assistant variables can also have a default value specified, using this syntax: {{user.name | default: "Not Known"}} 

User Variables

User variables let you use placeholders for data we get from the messaging platform about your users (or data that you set with Update User tasks). User variables start with "user" followed by a period and the variable name, like this: {{user.user_name}}

Here are the available variables for user (not not all variables will have data for all users or an all platforms):

Name ({{user.name}}
First Name {{user.first_name}}
Last Name {{user.last_name}}
Timezone {{user.timezone}}
Language {{user.language}}
Bot Language {{user.bot_language}}
Gender {{user.gender}}
Bot Platform {{user.bot_platform}} (web, telegram, etc)
First Active {{user.first_active}} (date/time)
Last Active {{user.last_active}} (date/time)

Data Variables

Data variables reference any variables you set in the 'Initial Data' section of the 'Run Assistant' task. 

Attribute Variables

Attribute variables let you reference any custom attribute you have set on the user so far. This is very powerful, as it allows you to provide summary data of a users current state, update welcome messages, and more from within your flows and then show that data on your menu pages.

Attribute variables are addressed like this {{attributes.VariableName}}

For example, if you have a user attribute called Email, you can display this in a message template with {{attributes.Email}}

NOTE: To reference attributes in message templates they cannot have any spaces in the names. {{attributes.My Variable}} won't work, but {{attributes.MyVariable}} or {{attributes.My_Variable}} will.

Metadata Variables

Metadata variables let you reference metadata fields found in a message. These vary from platform to platform, so check your interaction logs to find out what metadata you have available for the platform you are using. For example, on the web, you can get the page the bot is hosted on using {{metadata.hostUrl}}

Still need help? Contact Us Contact Us