# Field(Variable)


Before the detailed introduction of each step, let's take a look at what is field(variable) in UChat. It might take you a moment but this is essential to know more about the system.

Field, aka variable, is a container to hold a value.

Classification Description
system field and custom field system field is created by the system with pre-defined variable name and type, while custom field is defined by yourself
bot field and user field bot field is shared in the whole bot, while each user has his/her own set of user fields
text field, number field, boolean field, date field, datetime field and JSON field see variable type

# User Field

User field belongs to users. For example, each user has their own name and email address. So "name" and "email" are user fields.

# Bot Field

Bot field belongs to the bot. For example, a restaurant bot holds an address and contact number of the restaurant. So "restaurant_address" and "restaurant_contact" should be created as bot fields. Because you don't want to manage different addresses or contacts of your restaurant for every user.

# System Field

System field is created by the system with pre-defined variable name and variable type. There are system bot field and system user field:

Check the table below for how to edit system field:

Field Name Field Type Variable Type Description How to Edit
First Name user field text profile info in Question Step/Action Step
Last Name user field text profile info in Question Step/Action Step
User Name user field text profile info in Action Step
User Ns user field text user identification in UChat non-editable
User Id* user field text user identification from the channel non-editable
Gender user field text profile info in Action Step
Email user field text profile info in Question Step/Action Step
Phone user field text profile info in Question Step/Action Step
Profile Image user field text profile info non-editable
Locale user field text profile info non-editable
Timezone user field text profile info non-editable
Language user field text profile info in Action Step
Subscribed user field datetime subscribed time non-editable
Last Text Input user field text user's last input edited by system
Last Interaction user field datetime last action time edited by system
Last Button Title user field text last button pressed edited by system
NOW bot field datetime current time edited by system
TODAY bot field date current date edited by system
ITEM user field array (JSON) one item in a JSON in "For Each" message
SELECT user field array (JSON) selected item in "Select" new step
SHOP user field array (JSON) all store values in Ecommerce Integration
CART user field array (JSON) user shopping cart edited by your users
ORDER user field array (JSON) user's last order non-editable
User user field array (JSON) user's profile edited by system according to other profile values
DialogFlow user field array (JSON) DialogFlow response edited by DialogFlow agent

# User Id in Different Channels:

Channel Meaning Example Value
Facebook Unique Id in your Facebook page 3055090314593234
Telegram Unique Id in your Telegram bot 1173717756
Slack Unique Id in your Slack workspace U017MKNENH
WeChat Unique Id in your WeChat account oNzS3wpEjnA3tXmOcNxpqtAnBwWg
WhatsApp User's phone number 61412345678
SMS User's phone number +15203456789
Voice User's phone number +15203456789
Google Conversation Id from Google 8095938e-90cf-4347-ab94-9224308672b0


The unique id from the channel is only unique in your Facebook page, Telegram bot, Slack workspace or WeChat account, not the unique id in the whole Facebook, Slack, etc.

# Variable Type

There are 6 types of variable in UChat:

Type Storage Example Operations Supported
Text letters, words, sentences... Hi, UChat. cutting, change case, encode, decode...
Number number 123.45 + - x รท, mod, power, log, root, round...
Boolean either "1" or "0", for true or false 1 assign
Date date 2021-03-30 format, add months/weeks/days
DateTime date and time 2021-03-30 16:52:00 format, add months/weeks/days/hours/minutes
JSON (array) a series of variables {"name":"Jack", "age":"20"} load, get, update, remove, count, sum, average, sort, shuffle, reverse...

# Boolean Value

Note that

when you assign "false", "0", "no", null, blank value to a boolean variable, those will go to "false", and the rest are "true".

# Create Custom Field

Wow, now you are a master ๐Ÿ‘จโ€๐ŸŽ“ of field! Let's try it out! ๐Ÿ˜Ž๐Ÿ˜Ž

You can create variables in 2 ways:

Place Type Supported
in Contents section user field & bot field
anywhere you need to map result to variable, e.g. Question step, Integration, etc user field only

# Create in Contents


  1. go "Contents" from the left sidebar
  2. select User Fields or Bot Fields
  3. use folder to organize your fields if needed


Click the blue "+ New User/Bot Field" button on the right side to create a field. "Field Name" is a must. You can use any character to separate words like underline or space. We suggest you keep the field name as concise as possible, to avoid any possible display issue.

After that, pick a variable type. Add default value or description if needed. (default value is for bot fields only)

Folders can be used to organize variables. Trust me, you will need it when your flow goes big. ๐Ÿง

# Others

To create new fields in for example, the question step:


Type in a new variable name in the "Enter Field Name" box and click it in the drop-down list. Select correspond variable type and here you go.


Another example, create in an integration:


Last Updated: 9/30/2021, 7:09:35 AM