Computers are good at data processing, and it’s nice to have some cracking power in a bot. So we tried to make math and other data processing in Activechat as simple as possible.
DATA block is used to assign values to user attributes (variables).
When assigning values to user’s attributes, you can use:
- hard-coded values like “123” or “hot lead”
- other attributes, referenced by $
- combinations of both, with math or string operations
Currently, DATA block can perform these operations:
- “+” to add two numerical values
- “-” to subtract one value from another
- “*” to multiply values
- “/” to divide one value by another
- “%” to calculate division reminder
- “~” to concatenate two string values
If you try to perform an incorrect operation (for example, division by zero or adding a string to numerical value), error exit will be triggered, so it’s important to provide some kind of error handling in your chatbot to prevent confusion for chatbot users.
An example in the picture above will increment the value of $page attribute by 1.
We will be adding many more DATA blocks in the near future – data validation, arrays, objects, etc. Stay tuned to the updates!