Docs »

Bots »

Scripting »

Placeholders

In the last section we learned about variables. You have to set a variable before using it, and it can only be referenced by the same template that set it. In other words, they are temporary.

Placeholders are a special kind of variable that retain their value for the entire duration of a bot behavior. Once set, a placeholder is available for use by all templates within the same behavior.

Every key from a bot behavior’s dictionary is automatically available as a placeholder.

As far as template scripting is concerned, placeholders are variables. Anything you can do to a variable, you can do to a placeholder.



{{placeholder_name}}


I am the placeholder's value

Inserting placeholders

When building a template, you can use the Insert placeholder menu to browse and select placeholders.

Setting placeholders

To set or change a placeholder, you must use the Set custom placeholder action in a behavior, rather than the set command in a template.

The value of a placeholder can be set with a template referencing other placeholders.

Iterating placeholders

You can use the placeholders_list() function to retrieve the dictionary of placeholders as an object. This can be iterated, serialized as JSON, etc.