Start an action based on the value of a slot

Hello community. Since a few days I’m crashing on a problem. I would like to execute a custom action based on the value of a slot. For example if the slot is “1”, I execute the action “action_one”, but if the slot is “2”, I execute “action_two”. I would also like these actions to be taken into account in the rules and stories.

Hello!

Try the code below. Note that you must define my_slot as categorical in domain file

stories:
- story: run on my_slot=1
  steps:
  - intent: execute_action
  - slot_was_set:
    - my_slot: "2"
  - action: action_one

- story: run on my_slot=2
  steps:
  - intent: execute_action
  - slot_was_set:
    - my_slot: "1"
  - action: action_two

Have a look here to learn more:

Thanks for the help. It worked

1 Like