Chat Variables
Leverage dynamic data during live messaging.
Definition
Chat variables store information from a chat session, including data about the app, user, and any inputs during the interaction. These variables can be utilised in an AI agent's subsequent actions.
Actions & Delimiters
The following actions support chat variables. To display a variable's value within an AI agent's action content, enclose the variable name within curly braces { }
as a delimiter.
System Variables
The Set Chat Variable action can create new variables or reference existing system variables:
_user_input
_user_input
Captures and stores the player's input at each interaction stage within the AI agent. It is dynamic, meaning that it updates automatically each time the player enters a new input.
_lang
_lang
Records the language identified from the player's input during each interaction.
_channel_profile
_channel_profile
Holds profile information for the player as obtained from the messaging app. It includes details such as the player's ID in Yola, their display name, the type of channel they're using, their profile picture URL, and other information that varies depending on the app.
For players connecting through Webchat, this variable also captures additional information if certain features are activated in the Webchat settings, such as:
Data from a pre-chat form
Player's location and IP address
{
"id": JSHSFHDHBJVKOISFIU,
"display_name": "Weiying",
"location": "MY",
"email": "[email protected]",
"phone_number": "34898483245",
"ip_address": "0.0.0.0",
}
_customer
_customer
Note that "customer" is a legacy term for an audience member, now referred to as "players" in the current platform and documentation.
Contains profile information for players who have a Players profile in Yola. This includes their name, email, phone number, and any custom fields.
{
"id": customer.id,
"external_customer_id": customer.external_customer_id,
"name": customer.name,
"location": customer.location,
"email": customer.email,
"phone_number": customer.phone_number,
"provided_unique_id": customer.provided_unique_id,
"tags": list(set(customer_tags)),
"tag_groups": [tag_group.name for tag_group in customer.tag_groups],
"custom_fields": {
cf.custom_field.name: cf.value
for cf in (customer_custom_fields or [])
}
}
_channel
_channel
Channel variables store information about a channel such as the channel ID, channel type, and other details unique to each channel.
{
"id": channel.id,
"type": "webchat",
}
_new_ticket
_new_ticket
Contains ticket info when a new email ticket is created.
{
"id": new_ticket_id,
"title": subject,
"customer_id": customer_id,
"assignee_type": assignee.type,
"assignee_id": assignee.id,
"description": description,
"bot_id": bot.id,
"channel_id": channel.id,
"custom_attrs": ["fetched_custom_field.name: cf.value"]
}
_track.fetch_ticket_by_ticket_id("ticket_id_here")
_track.fetch_ticket_by_ticket_id("ticket_id_here")
Ticket variable that fetches ticket info by ticket ID.
{
"id": new_ticket_id,
"status": ticket_status,
"assignee_names": [assignee_names],
"assigned_team_names": [assigned_team_names],
"customer_name": customer_name
}
_track.fetch_tickets_by_email("customer_email_here")
_track.fetch_tickets_by_email("customer_email_here")
Ticket variable that returns a list of tickets and their info by user email.
[
{
"id": new_ticket_id,
"status": ticket_status,
"assignee_names": [assignee_names],
"assigned_team_names": [assigned_team_names],
"customer_name": customer_name
}
...
]
Last updated
Was this helpful?