Cannot save button payload from custom action into slot - action_default_fallback error occurs and slot get deleted

Hello all together, i try to set up an food advise bot with rasa, for my frontent i use react-chat-widget. But i have the following problem: i want to save the button payload into a slot. My first custom action is also working and send the buttons to FE, after pressing the button the slot get filled with the correct data. It also recognize my intent “choose” correctly and try to keep on with my second action. But here always a failure occurs.

These are my two custom actions:

# function for asking user for being vegan, vegetarian - send buttons to the FE
class ActionAskForVegetarian(Action):

    def name(self) -> Text:
        return "ask_for_veg"

    def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict
    ) -> List[EventType]:
        dispatcher.utter_message(
            text="Bist du Vegetarier, Vegan oder Allesesser?:",
            buttons=[{"payload": "/choose{\"veg_ent\": \"eat_all\"}", "title": "Allesesser"},
                     {"payload": "/choose{\"veg_ent\": \"vegan\"}", "title": "Vegan"},
                     {"payload": "/choose{\"veg_ent\": \"vegetarian\"}", "title": "Vegetarier"}]

        )
        return []


# function which saves decision from above function to a slot and reply to the user
class ActionSetSlotAndReplyVegetarian(Action):

    def name(self) -> Text:
        return "reply_to_veg"

    def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict
    ) -> List[EventType]:
        reply = tracker.get_slot('veg_slot')

        # reply to the user that veg decision is saved in a slot - bot will remember
        dispatcher.utter_message(
            text=f"Gut ich merke mir, dass du {reply} bist!"
        )
        return []

my domain file:

intents:
  - greet
  - goodbye
  - affirm
  - deny
  - mood_great
  - mood_unhappy
  - bot_challenge
  - advice
  - no_advice
  - decide_for_direction
  - ital
  - amerik
  - choose_food
  - next_food
  - finish_choosing_category
  - choose

entities:
  - veg_ent

slots:
  veg_slot:
    type: text
    influence_conversation: false
    mappings:
      - type: from_entity
        entity: veg_ent
actions:
- ask_for_veg
- reply_to_veg


session_config:
  session_expiration_time: 60
  carry_over_slots_to_new_session: false



In my NLU file i have the intent “choose” and story looks like this:

stories:
- story: happy advice path
  steps:
    - intent: greet
    - action: utter_support_question
    - intent: advice
    - action: ask_for_veg
    - intent: choose
    - action: reply_to_veg

until this point everything is fine, but last action doesn’t want to work

Does anybody know where the failure is and if i need forms for filling buttons via custom actions? Thanks in advance

And i use Rasa Version 3.1

Hi! Can you test using this format?

        buttons = []

        #append the response of API in the form of title and payload

        buttons.append({"title": "Allesesser" , "payload": '/choose{"veg_ent":"eat_all"}'})

        #then display it using dispatcher

        dispatcher.utter_message(text="message you want to display" , buttons=buttons)
        return []

and i think you need to use slot_was_set in stories.yml too

  - slot_was_set:
    - requested_slot: veg_ent
  - slot_was_set:
    - veg_ent: eat_all

Look this examples in github. I think will help you :smiley:

@itsjhonny first thank u very much, but i tried to implemented like u suggested but same failure again… it writes the information in the slot but than “action default fallback” occurs and it doesnt keep on with my last custom action:

@itsjhonny finally i solved it. My problem was that i partly used a old rasa 2.x syntax. I had to added it like this:

 - intent: choose
      entities:
      - veg_ent: eat_all
    - slot_was_set:
      - veg_slot: eat_all
    - action: reply_to_veg

and i also added the entities in the nlu file and it worked:

- intent: choose
  examples: |
    - ich wähle [eat_all](veg_slot)
    - ich möchte gerne [veg](veg_slot)
    - ich fühle mich [eat_all](veg_slot) zugehörig
    - ich bin [vegetarian](veg_slot)