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:

Hello {{user_name}}, how are you?

Assuming that the variable user_name has "gian" as value, the text at runtime will automatically become:

Hello gian, how are you?

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:

{
    "code":"101021",
    "Name": "Super Customer",
    "Level":"Vip Customer",
    "Points": [
        {
            "Value":2500
        }
    ]
}

To access, for example, the value of points you can use Dynamic Parsing like this:

Hello {{user_data.Name}}! You currently have {{user_data.Points[0].Value}}!

The result, at runtime, will become like this:

Hello Super Customer! You currently have 2500!

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:

Hello {{user_data.Name}}! We have found {{user_data.Points.(Length)}} value(s)!

Will be translated to:

Hello Super Customer! We have found 1 value(s)!

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:

Hello \{\{user_name\}\}!

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:

Hello {{user_name}}, how are you?

You can reference english_salutation in any standard text like you normally would:

{{english_salutation}}

And the Xenioo runtime will recursively parse the reference. As a result, your final text at runtime will be:

Hello gian, how are you?

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:

Hello \{\{user_name\}\}, how are you?

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