Usually when you present buttons to the user, you want the user to click a button before continuing. Sometimes, though, it can be handy to present buttons to the user and continue on to the next step without waiting for the user’s response. This section explains how to do that.
To create a component with buttons or quick replies that doesn’t wait for the user’s response, make sure that none of the buttons or quick replies contain the
Some components, such as the
askcomponent, always contain a dynamic trigger and never continue the flow automatically.
In this example, one of the buttons has a type of
flow_next, which creates a dynamic trigger. As a result, the flow will wait until a button has been clicked before continuing.
Create a flow called
optional_button.yaml and copy this code into it:
triggers: - keyword: test steps: - tiles: - title: Button with dynamic trigger. buttons: - text: Bird icon: (@ config.icon.bird ) - text: Cat icon: (@ config.icon.cat ) result: foo # Creates a dynamic trigger - text: Dog icon: (@ config.icon.dog ) - say: Done!
Save the file and push your code to the Grid by running these commands in your terminal:
meya format meya push
In this example, all of the buttons have a type of
text, meaning they do not create dynamic triggers, so the flow will automatically move on to the
Replace the code in
optional_button.yaml with this code:
triggers: - keyword: test steps: - tiles: - title: Button with dynamic trigger. buttons: - text: Bird icon: (@ config.icon.bird ) - text: Cat icon: (@ config.icon.cat ) - text: Dog icon: (@ config.icon.dog ) - say: Done!
Updated 4 months ago