Dynamic Parsing And Content
Xenioo Dynamic Parsing let you specify any variable inside any action or operation text field. Each variable is then transformed at runtime to the current value.
Dynamic Parsing is activated by enclosing the variable name (or name + property tree) between double curly brackets. So, for example, to use a simple salutation specifying your contact user_name, you may do something like this:
Assuming that the variable user_name has "gian" as value, the text at runtime will automatically become:
JSON Objects
Dynamic parsing fully supports real-time JSON parsing: object properties and indexes can be specified using standard property notation to access complex values. Let's assume that the variable user_data holds the following value:
To access, for example, the value of points you can use Dynamic Parsing like this:
The result, at runtime, will become like this:
When using JSON arrays, you can use the (Length) syntax to know the number of elements contained. So, as an example, using a syntax like this:
Will be translated to:
If you need to avoid parsing of a specific content where, for some reason, you are using the same syntax as Xenioo variables, just make sure to escape each double curly bracket like this:
Variables Text Editor
Dynamic Parsing is supported in all text fields of every action or operation. To help you mix your text with variables, in every text control a small button will appear:
This button will open the Variables Text Editor Window. From this window you can freely write your text and dynamically pick any variable you need from your chatbot runtime.
Recursive Parsing
Xenioo Dynamic Parsing fully support reference recursiveness to up to 5 levels of recursion depth. What it means is that a variable can hold a variable reference and that both will be parsed at runtime with the actual value. So, for example the variable english_salutation can hold the following value:
You can reference english_salutation in any standard text like you normally would:
And the Xenioo runtime will recursively parse the reference. As a result, your final text at runtime will be:
Recursive Parsing can be very helpful with complex, variable based flows where some text is stored in API Results or in text dictionaries like you would do when creating multi-language bots.
You can disable Recursive Parsing by escaping all curly braces with a backslash like in the following example:
Xenioo will ignore escaped variable names and leave the value as it is.
Content Formatting
Some channels like WhatsApp or Telegram natively support formatting using some basic or simplified Markdown syntax. This syntax can always be used anywhere in Xenioo and will be correctly translated to the target channel.
Additionally, Xenioo supports the very same syntax also on Web Channel so that compatibility of layout is maintained on multiple platforms.
You can use the following simplified syntax to format any Web Channel text:
Italic
To italicize your message, place an underscore on both sides of the text, like so:
_text_
Bold
To bold your message, place an asterisk on both sides of the text, like so:
*text*
Strikethrough
To strikethrough your message, place a tilde on both sides of the text, like so:
~text~
Of course, the Web Channel fully supports standard HTML syntax but it may prove difficult later to migrate the chatbot to another channel.
Last updated