How to have different form for each slot?

What I am trying to do is-

  • User : Hi !!
  • Bot : Hi !! How may I help you ? Please choose the option for which I can help you ? 1. Help A 2. Help B 3. Help C
  • User chooses any of the options

Now, I have made a categorical slot for the Help A, B & C options but what I want is that for each chosen Help option a different form action is called, like if the user chooses Help A then form_helpA is called, if Help B is chosen then form_helpB is called. Basically, for each option I want a different form action to be called because each form has different slots and functions. So, what is happening currently that on choosing any of the Help A / B / C option always the form_helpA is called instead of their corresponding forms being called

How can i fix this ?

You can easily solve this problem by implementing slot-dependent stories. Have a look at the very bottom code snippet of this documentation. It should give you a fairly good idea as to how you should proceed. Something like so:

# storyA
...
* input_get_help_category{"help_slot": "help_A"}
  - form_help_A
...

# storyB
...
* input_get_help_category{"help_slot": "help_B"}
  - form_help_B
...

# storyC
...
* input_get_help_category{"help_slot": "help_C"}
  - form_help_C
...

With each form being defined in your actions.py file, of course.

1 Like

I coded as you suggested and its working. Thanks a lot for helping !!!