Variables and Tags

One of the pillars of your chatbot flow with Xenioo are Variables and Tags: while building your chatbot you will use both extensively to identify your users, store and display relevant runtime data.

Variables

Variables are entities defined through a name and value pair. Each variable has a name and an assigned value. While variables are defined globally during chatbot design, they all become bound to each conversation. For example if you define the variable favorite_color in your chabot design, all conversation will have it and each conversation may have a different value assigned.

Xenioo manages both basic, direct valued variables and complex object variables. Direct valued variables are the most common as they just old simple values like favorite_color="red". Complex object variables hold an object instance and can be accessed in both raw JSON value or by property name notation. A variable defined as follows:

favorite_color = {
    "name":"Red",
    "value":"ff0000"
}

Can be accessed and automatically parsed both by referring to favorite_color, which will return the full JSON or by favorite_color.name, which will just return Red.

There are no limits to the number of variables your chatbot conversation can have.

Default Variables

By default, the following variables are added to your chatbot runtime by Xenioo:

Name

Description

user_name

The username (or nickname) of the user, if available.

first_name

The first name of the user

last_name

The last name of the user

locale

The locale of the user in 4 letters iso format (e.g. en-US)

user_id

The channel based user id. This value is unique to the channel

x-token

Single use throw away token. The value changes every time it is used

bot_name

The name of your bot, as set in your settings.

bot_channel

The name of the current conversation channel (e.g. "WhatsApp" )

last_user_message

The last message the user has sent

last_command

The last command that was triggered by the user

detected_locale

The locale that Xenioo has detected by NLP or scripting in 4 letters iso format (e.g. en-US)

input_fail_count

The last number of failed inputs

input_fail_triggered

Contains true if the last input has triggered a failure. Otherwise false

chat_state

Contains the current chat state according to the table below

first_contact

The full date and time of the very first contact your chatbot had with the current user.

first_contact_day

The day of the month of the very first contact your chatbot had with the current user.

first_contact_weekday

The full name of the day of the week (e.g. Saturday) of the very first contact your chatbot had with the current user.

first_contact_month

The month of the very first contact your chatbot had with the current user.

first_contact_year

The year of the very first contact your chatbot had with the current user.

last_actor

Contains a fixed value representing the last platform actor to interact in the current flow. It may contain "user" if the last interaction was from the user or "xenioo" if the chatbot was the originator of the last message or the operator email, if the last message was from an operator.

last_contact

The full date and time of the last contact that your chatbot had with the current user. If the conversation is alive, this value is constantly updated after each interaction.

last_contact_day

The day of the month of the last contact your chatbot had with the current user.

last_contact_weekday

The full name of the day of the week (e.g. Saturday) of the last contact your chatbot had with the current user.

last_contact_month

The month of the last contact your chatbot had with the current user.

last_contact_year

The year of the last contact your chatbot had with the current user.

optin_message

If the channel requires an optin message (e.g. WhatsApp) this variable will hold the value of the very first message sent by the current user to the channel.

conversation_topics

The number of topics collected by the current conversation.

device_state

The device state retrieved by Xenioo IoT actions. May vary depending on device.

conversation_state

The current conversation state in extended string format. Can be either Chatbot, OperatorRequested, OperatorTakenOver or UserBanned.

online_operators_count

The number of operators online for the current chatbot. This value is updated on every user interaction. When not looking at a live conversation it may represent a stale value.

online_operators

The full list of operators currently online separated by a semicolon. Like for the operators count, this value is updated on every user interaction. When not looking at a live conversation it may represent a stale value.

operator

The operator email of the currently active operator. This variable is valued only if the current conversation is taken over.

operator_name

The full operator name (Account Name) of the active operator. This variable is valued only if the current conversation is taken over.

operator_group

The full group name of the currently active operator. This variable is valued only if the current conversation is taken over.

operator_interacted

True if the operator talked at least once with the user since take over. Empty otherwise.

streaming_offset

The current offset of an ongoing streaming action. It represent the position along the stream in milliseconds.

current_stream_token

The current unique token associated with the streaming operation.

previous_stream_token

The unique token associated to the previous streaming operation.

current_audio_action

The current audio action as requested by an incoming state change in any IoT device update.

message_type

This variable will hold the type of message sent by the user. This variable is empty if the message is of type text, otherwise will contain either "image", "audio", "voice" or "file".

Default Tags

The following tags are created automatically by Xenioo during your chatbot runtime:

Tag

Description

NEW_USER

This tag is automatically added to a user if a previous conversation is not found. This tag is automatically removed when the user comes back to the chatbot after at least 30 minutes.

Chat State Values

The chat_state variable may contain the following values, depending on the current state of the chat:

Value

Description

Empty/Unset

The chat is in its default state. Xenioo is controlling your chatbot replies.

operator_requested

An operation has set the request operator flag. The chat is waiting to be taken over by an operator

take_over

The chat has been taken over by an operator and its currently managed by a human.

Please note that, depending on the channel and depending on specific user related privacy settings, some of the above variables may not be available. Additional, specific variables, may be added automatically to your chatbot runtime depending on the channel used by the user. Refer to each channel specific information for a complete list.

Privacy Variables

Privacy variables are a special type of variables that cannot be altered in any way from outside or inside the chatbot runtime.

These variables hold the selected privacy preferences of your user and only a Privacy Opt-in Action can alter these variables.

Tags

Tags are single named entities that can be attached to the conversation to later filter or switch the flow based on their presence (or the absence). If you do not need to store a value but you need to represent a simple flag, Tags are generally better.

By default, your chatbot will have the following tags:

Tag

Description

NEW_USER

Automatically added to the conversation on the very first contact. Subsequent conversations with the same user will no longer have this tag.

Data Persistence

Both variables and tags are uniquely stored for each of you chatbot conversation. Every change you make to a variable or tag during your chatbot runtime is scoped to only the current conversation.

Every variable and tag is persisted in the conversation and kept available for any future contact or broadcast until you, or the user, choose to forget it.

Last updated