I am working on online food ordering bot, where user select cuisine and then choose item / dish based on cuisine user have selected. And then bot ask the user “If you want add more item?” with the options/buttons “Yes” and “No”.
I want to make this process repeat until user deny, i.e. user say “No”, to add more item into list. And collect all the item / dish into list, an entity.
How I can achieve this? I tried using the form but, no success.
And also my cuisine and menu item both are fetch using API and both of them have separate actions, namely action_ask_cuisine and action_ask_menu_item respectively.
How I can repeat the below flow as in sequential order:
Ask user to choose cuisine (from buttons).
Based on selected cuisine, fetch menu item and display to user to select(this will also in buttons).
Store the selected menu item and ask user if he/she want to add more item.
If user reply “Yes”, then start again from “1”, else end.
I think a form is what you want, but you’ll need to be careful about how/when slots are set. Also, your two separate actions would need to become part of the form.
What you can do is add a payload to the button that resets a required slot to null. E.g. you can have an order_complete required slot:
forms:
order_form:
<cuisine & menu item slot mappings>
order_completed:
- type: from_intent
intent: affirm
value: null
- type: from_intent
intent: deny
value: true
responses:
< other responses>
utter_ask_order_form_order_completed:
- text: Do you want to add an item?
buttons:
- title: Yes
payload: /affirm
- title: No
payload: /deny