Create Dynamic Suggested Replies

Sometimes we need to dynamically show/hide Suggested Replies in a module. That is achievable in two ways:

1) By using standard Custom Variable print statement like [[cvar_name]] 

For example, if you want to show the "Live Chat" Suggested Reply button only during business hours, you can set the sr_live_chat variable to "Live Chat" during business hours and to an empty string (by using Jinja code ) outside of business hours. When sr_live_chat is empty no button will be shown.

in the Module connection, you use the same print variable notation for the condition:

 

2) Or by using the special variable type "list"

The format is very simple, you need to type the following in the Suggested Replies field:

[customVariable key=custom_variable type=list]

To work properly, a list with the correct JSON list format needs to be created (dynamic or static) from a Webhook response or a Module Connection. Screenshot 2022-10-20 at 11.20.23

You can apply this filter in a Bot Message or as a Suggested Reply, as shown here:Screenshot 2022-10-20 at 11.30.26
The result appear as such:
Screenshot 2022-10-20 at 11.34.06