Field (Variable)
TIP - Before the detailed introduction of each step, let's take a look at what is field(variable) in NewAge Ai. 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:
Some system fields only exist in the specific channel. Check the table below for how to edit system field:
Field Name | Field Type | Variable Type | Description | How to Edit
User Ns | user field | text | user identification in NewAge Ai | non-editable
User Id* | user field | text | user identification from the channel | non-editable
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
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 | in Question Step
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
Flow Ns | bot field | text | flow(bot) identification in NewAge Ai | non-editable
Sub Flow Ns | bot field | text | sub flow identification in NewAge Ai | non-editable
Page Name | bot field | text | connected Facebook page name | non-editable
Page Id | bot field | text | connected Facebook page id | non-editable
Page User Name | bot field | text | username of the page in Facebook | non-editable
Last FB Comment | user field | text | user's last comment text in the Facebook page | edit by system
Last FB Comment Post Id | user field | text | post id of where user put the last comment | edit by system
Last FB Comment total tagged users | user field | number | tagged users amount in last comment | edit by system
Last FB Comment total new tagged users | user field | number | tagged but haven't subscribed(to bot) users amount | edit by system
Last FB Comment is existing users | user field | number | before this comment, is he/she an existing user? yes=1,no=0 | edit by system
Live Chat Url | user field | text | (for agent) visit to talk to user in live chat | edit by system
NOW | user field | datetime | current time in user's timezone* | edited by system
TODAY | user field | date | current date in user's timezone* | edited by system
BOT_CURRENT_TIME | bot field | datetime | current datetime in workspace's timezone | edited by system
ITEM | user field | array (JSON) | each item in a JSON | in "For Each" message
SELECT | user field | array (JSON) | selected item | in "Select" new step
SHOP | bot field | array (JSON) | store information | in Ecommerce Integration
CART | user field | array (JSON) | user shopping cart | in Action Step
ORDER | user field | array (JSON) | user's last order | edited by system
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
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:
Channel | Meaning | Example Value
Facebook | Unique Id in your Facebook page | 6288386817841812
Instagram | Unique Id in your Instagram bot | 6570462892993643
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 without + | 61412345678
SMS | User's phone number | +61412345678
Voice | User's phone number | +61412345678
Google | Conversation Id from Google | 8095938e-90cf-4347-ab94-9224308672b0
Line | Unique Id in your Line bot | Ub02c77c69c59c5be5597d58ce2701ebe
Viber | Unique Id in your Viber bot | mdY9hOWdeQC6J/Sl19Qh8A==
Vk | Unique Id in your Vk bot | 705862439
Tiktok | Unique Id in your TikTok bot | 14b9d453a3dcbdc6ff6acfebe6a9588a
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 NewAge Ai:
Type | Storage | Example | Operations Supported
Text | letters, words, sentences... | Hi, NewAge Ai. | cutting, change case, encode, decode...
Number | numbers | 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 | 2022-01-01T12:00:00+10: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
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:
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 Custom Field in Contents Section
- Go to Contents from the left sidebar.
- Select User Fields or Bot Fields.
- Click + User Field (or + Bot Field), enter the field name, and choose the Type. Optionally add a Description and assign it to a Folder, then click Save. For Bot Fields you can also set a Value and Sample values.
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:
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: