cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Flow Advance: String templates

Flow Advance: String templates

Within text replies you can use params that are matched by the AI or collected using Any text.

If you trained the AI to match entities they can be used with a template syntax.
For example, if you trained the AI with an entity named country, you will be able use it like so:
I am going to check the weather for {{country}}

This would result in a response like:

I am going to check the weather for France

Param value

Entity matches could be fuzzy and by default string templates print the value of a matched parameter.

You can also access the match by using {{param.match}}

String templates can be used in different replies like:

  • Text replies
  • Titles and subtitles of a card
  • Button labels.
 

string_templates.png

Param selection

Matched params with the same name are appended and multiple params render as a list within string templates.

You have the option to select the elements that will be rendered. For example to access the last element of the list use param.last.match:

 

param_selection3.png

The first element of the list can be accessed by param.first.match or param.0.match.

It also works with the following: 

value: param.first.value, param.last.value, param.*any_digit*.value.

Filters

String templates also support advanced formatting filters. The following are supported:

Category Filter
Math plus, minus, modulo, times, floor, ceil, round, divided_by, abs
String append, prepend, capitalize, upcase, downcase, strip,lstrip, rstrip, strip_newlines, split, replace, replace_first, remove, remove_first, truncate, truncatewords
Date format like strftime

 

For example, a date can be rendered in different formats:

 

string_templates_date5.png

 

Flow Advance: String templates

Within text replies you can use params that are matched by the AI or collected using Any text.

If you trained the AI to match entities they can be used with a template syntax.
For example, if you trained the AI with an entity named country, you will be able use it like so:
I am going to check the weather for {{country}}

This would result in a response like:

I am going to check the weather for France

Param value

Entity matches could be fuzzy and by default string templates print the value of a matched parameter.

You can also access the match by using {{param.match}}

String templates can be used in different replies like:

  • Text replies
  • Titles and subtitles of a card
  • Button labels.
 

string_templates.png

Param selection

Matched params with the same name are appended and multiple params render as a list within string templates.

You have the option to select the elements that will be rendered. For example to access the last element of the list use param.last.match:

 

param_selection3.png

The first element of the list can be accessed by param.first.match or param.0.match.

It also works with the following: 

value: param.first.value, param.last.value, param.*any_digit*.value.

Filters

String templates also support advanced formatting filters. The following are supported:

Category Filter
Math plus, minus, modulo, times, floor, ceil, round, divided_by, abs
String append, prepend, capitalize, upcase, downcase, strip,lstrip, rstrip, strip_newlines, split, replace, replace_first, remove, remove_first, truncate, truncatewords
Date format like strftime

 

For example, a date can be rendered in different formats:

 

string_templates_date5.png

 
Last Reviewed:
02-18-2022 03:36 PM

Flow Advance: String templates

Within text replies you can use params that are matched by the AI or collected using Any text.

If you trained the AI to match entities they can be used with a template syntax.
For example, if you trained the AI with an entity named country, you will be able use it like so:
I am going to check the weather for {{country}}

This would result in a response like:

I am going to check the weather for France

Param value

Entity matches could be fuzzy and by default string templates print the value of a matched parameter.

You can also access the match by using {{param.match}}

String templates can be used in different replies like:

  • Text replies
  • Titles and subtitles of a card
  • Button labels.
 

string_templates.png

Param selection

Matched params with the same name are appended and multiple params render as a list within string templates.

You have the option to select the elements that will be rendered. For example to access the last element of the list use param.last.match:

 

param_selection3.png

The first element of the list can be accessed by param.first.match or param.0.match.

It also works with the following: 

value: param.first.value, param.last.value, param.*any_digit*.value.

Filters

String templates also support advanced formatting filters. The following are supported:

Category Filter
Math plus, minus, modulo, times, floor, ceil, round, divided_by, abs
String append, prepend, capitalize, upcase, downcase, strip,lstrip, rstrip, strip_newlines, split, replace, replace_first, remove, remove_first, truncate, truncatewords
Date format like strftime

 

For example, a date can be rendered in different formats:

 

string_templates_date5.png

 
Version history
Last update:
‎06-16-2021 10:11 AM
Updated by:
Contributors