Variables

Yola Variables store and retrieve information during a chatbot interaction, such as user input, customer details, and communication channel information. These variables can be used across bot actions to dynamically display or manipulate data.

Using Variables in Bot Actions

Variables are applied differently depending on the bot action:

Bot Actions That Require Delimiters e.g.{_customer.id}

For these bot actions, you must enclose the variable name in curly braces {}:

  • Bot Message

  • Carousel

  • Create Case

  • Email

  • Hyperlink

  • Survey

Bot Actions That Do Not Require Delimiters e.g.{_customer.id}

For these bot actions, variables are inserted directly into the input fields. These input boxes are identified by the </> ProtoScript label at the bottom:

  • Branch (e.g. for POST when a JSON input is required)

  • JSON API

  • Modify Variable


Available Variables

_user_input

Captures and stores the most recent input provided by the user during the chat.

Example:

Example value of a _user_input variable
"user_input": "I need help resetting my password"

_lang

Captures the language detected from the user's input during the session.

Example:

Example value of a _lang variable
"_lang": "en"

_channel_profile

Stores the profile information of the user based on the communication channel. For Webchat, additional information such as IP address, and location is captured.

Example:

Example value of a _channel_profile variable
{
  "id": "01JF81FGTHY56BG5G9EDNVSK9C",
  "display_name": null,
  "location": null,
  "email": null,
  "phone_number": null,
  "ip_address": "209.35.184.212",
  "info": {}
}

_customer

Captures the customer profile, including any custom fields populated by the pre-chat form on Webchat apps.

Example:

Example value of a _customer variable
{
  "id": "01JF81FGTE44Q56M881BKNH1Q5",
  "external_customer_id": null,
  "name": "team",
  "location": null,
  "email": null,
  "phone_number": null,
  "provided_unique_id": null,
  "tags": [],
  "tag_groups": [],
  "custom_fields": {"Loyalty Level": "Silver"}
}

_channel

Contains information about the communication channel where the chat occurs.

Example:

Example value of a _channel variable
{
  "id": "channel_01",
  "type": "webchat"
}

_new_ticket

Provides details of a newly created ticket, including its ID and key attributes.

Example:

Example value of a _new_ticket variable
{
  "id": "new_ticket_123",
  "title": "Password Reset Request",
  "customer_id": "01JF81FGTE44Q56M881BKNH1Q5",
  "assignee_type": "team",
  "assignee_id": "CS Team",
  "description": "User needs help resetting their password",
  "bot_id": "bot_01",
  "channel_id": "channel_01",
  "custom_attrs": ["Priority: High"]
}

_track.fetch_ticket_by_ticket_id("ticket_id_here")

Fetches details of a specific ticket using its Ticket ID.

Example:

Example value of _track.fetch_ticket_by_ticket_id("ticket_id_here") variable
{
  "id": "ticket_123",
  "status": "open",
  "assignee_names": ["George Maputol"],
  "assigned_team_names": ["VIP Managers"],
  "customer_name": "team"
}

_track.fetch_tickets_by_email("customer_email_here")

Fetches all tickets associated with a customer's email address.

Example:

Example value of a _track.fetch_tickets_by_email("customer_email_here") variable
[
  {
    "id": "ticket_123",
    "status": "open",
    "assignee_names": ["George Maputol"],
    "assigned_team_names": ["VIP Managers"],
    "customer_name": "team"
  },
  {
    "id": "ticket_456",
    "status": "resolved",
    "assignee_names": ["Team Yola"],
    "assigned_team_names": ["CS Team"],
    "customer_name": "team"
  }
]

Notes on Usage:

  1. Delimiters: Use {} delimiters only when required. For ProtoScript-enabled fields (</> ProtoScript), input variables directly without delimiters.

  2. Pre-Chat Form: Custom fields collected through the pre-chat form automatically populate into the _customer variable under custom_fields.

  3. Dynamic Data: Variables like _user_input update dynamically as the user provides new inputs.


Last updated