fbpx

Field (Variable)

4 min read

TIP

Before the detailed introduction of each step, let’s take a look at what is field(variable) in Omni. 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.

ClassificationDescription
system field and custom fieldsystem field is created by the system with pre-defined variable name and type, while custom field is defined by yourself
bot field and user fieldbot 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 fieldsee 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:

Some system fields only exist in the specific channel. Check the table below for how to edit system field:

Field NameField TypeVariable TypeDescriptionHow to Edit
User Nsuser fieldtextuser identification in Omninon-editable
User Id*user fieldtextuser identification from the channelnon-editable
First Nameuser fieldtextprofile infoin Question Step/Action Step
Last Nameuser fieldtextprofile infoin Question Step/Action Step
User Nameuser fieldtextprofile infoin Action Step
Genderuser fieldtextprofile infoin Action Step
Emailuser fieldtextprofile infoin Question Step/Action Step
Phoneuser fieldtextprofile infoin Question Step/Action Step
Profile Imageuser fieldtextprofile infoin Question Step
Localeuser fieldtextprofile infonon-editable
Timezoneuser fieldtextprofile infonon-editable
Languageuser fieldtextprofile infoin Action Step
Subscribeduser fielddatetimesubscribed timenon-editable
Last Text Inputuser fieldtextuser’s last inputedited by system
Last Interactionuser fielddatetimelast action timeedited by system
Last Button Titleuser fieldtextlast button pressededited by system
Flow Nsbot fieldtextflow(bot) identification in Omninon-editable
Sub Flow Nsbot fieldtextsub flow identification in Omninon-editable
Page Namebot fieldtextconnected Facebook page namenon-editable
Page Idbot fieldtextconnected Facebook page idnon-editable
Page User Namebot fieldtextusername of the page in Facebooknon-editable
Last FB Commentuser fieldtextuser’s last comment text in the Facebook pageedit by system
Last FB Comment Post Iduser fieldtextpost id of where user put the last commentedit by system
Last FB Comment total tagged usersuser fieldnumbertagged users amount in last commentedit by system
Last FB Comment total new tagged usersuser fieldnumbertagged but haven’t subscribed(to bot) users amountedit by system
Last FB Comment is existing usersuser fieldnumberbefore this comment, is he/she an existing user? yes=1,no=0edit by system
Live Chat Urluser fieldtext(for agent) visit to talk to user in live chatedit by system
NOWuser fielddatetimecurrent time in user’s timezone*edited by system
TODAYuser fielddatecurrent date in user’s timezone*edited by system
BOT_CURRENT_TIMEbot fielddatetimecurrent datetime in workspace’s timezoneedited by system
ITEMuser fieldarray (JSON)each item in a JSONin “For Each” message
SELECTuser fieldarray (JSON)selected itemin “Select” new step
SHOPbot fieldarray (JSON)store informationin Ecommerce Integration
CARTuser fieldarray (JSON)user shopping cartin Action Step
ORDERuser fieldarray (JSON)user’s last orderedited by system
Useruser fieldarray (JSON)user’s profileedited by system according to other profile values
DialogFlowuser fieldarray (JSON)DialogFlow responseedited by DialogFlow agent

*Note

If the channel doesn’t support timezone in user’s profile, or, the channel supports but the user don’t have a timezone value, workspace timezone will be used instead.

User Id in Different Channels: #

ChannelMeaningExample Value
FacebookUnique Id in your Facebook page6288386817841812
InstagramUnique Id in your Instagram bot6570462892993643
TelegramUnique Id in your Telegram bot1173717756
SlackUnique Id in your Slack workspaceU017MKNENH
WeChatUnique Id in your WeChat accountoNzS3wpEjnA3tXmOcNxpqtAnBwWg
WhatsAppUser’s phone number without +61412345678
SMSUser’s phone number+61412345678
VoiceUser’s phone number+61412345678
GoogleConversation Id from Google8095938e-90cf-4347-ab94-9224308672b0
LineUnique Id in your Line botUb02c77c69c59c5be5597d58ce2701ebe
ViberUnique Id in your Viber botmdY9hOWdeQC6J/Sl19Qh8A==
VkUnique Id in your Vk bot705862439

Note

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 Omni:

TypeStorageExampleOperations Supported
Textletters, words, sentences…Hi, Omni.cutting, change case, encode, decode…
Numbernumbers123.45+ – x ÷, mod, power, log, root, round…
Booleaneither “1” or “0”, for true or false1assign
Datedate2021-03-30format, add months/weeks/days
DateTimedate and time2022-01-01T12:00:00+10:00format, 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 #

When these values stored in the field, the boolean return false, otherwise it goes true:

  • empty
  • null
  • ‘false’
  • false
  • ‘no’
  • 0

Create Custom Field #

Wow, now you are a master 👨‍🎓 of field! Let’s try it out! 😎😎

You can create variables in 2 ways:

PlaceType Supported
in Contents sectionuser field & bot field
anywhere you need to map result to variable, e.g. Question step, Integration, etcuser field only

Create Custom Field in Contents Section #

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

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. 🧐

Create Custom Field in Question and Action Step #

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

question

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:

question
Leave a Reply

Your email address will not be published.Required fields are marked *