How to handle user feedback using formaction


I want to have a user feedback. Since it is a text that can be anything entered by bot, how to capture that field. Also i tried it using formaction, but since classification happens, i wish to avoid that state. Is it possible to do so ?

1 Like

This is how I get a suggestion from the user.

You will require a “requested_slot” and “suggestion” slot (in your case feedback).

import os
import requests
from rasa_core_sdk.forms import FormAction
from import SlotSet

class FormSuggestion(FormAction):
    """Example of a custom form action"""

    def name(self):
        # type: () -> Text
        """Unique identifier of the form"""

        return "form_suggestion"

    def required_slots(tracker):
        # type: () -> List[Text]
        """A list of required slots that the form has to fill"""

        return ["suggestion"]

    def validate(self, dispatcher, tracker, domain):
        """Validate extracted requested slot
            else reject the execution of the form action
        requested_slot = tracker.get_slot("requested_slot")
        if not requested_slot or requested_slot != "suggestion":
            return [SlotSet("requested_slot", "suggestion")]
        return [SlotSet("suggestion", tracker.latest_message['text'])]

    def submit(self, dispatcher, tracker, domain):
        # type: (CollectingDispatcher, Tracker, Dict[Text, Any]) -> List[Dict]
        """Define what the form has to do
            after all required slots are filled"""

        suggestion = tracker.get_slot("suggestion")
        # do something with suggestion
        return [SlotSet("suggestion", None), SlotSet("requested_slot", None)]

Can you please provide stories for the same. My concern is that feedback going for intent classification that I don’t need.

It will not go to the NLU it will stay stuck in validation until the required slot is filled …

My story …


  • give_suggestion
  • utter_request_suggestion
  • affirm
  • action_fetch_user
  • slot{“name”: “Johannes”}
  • slot{“requested_slot”: null}
  • form_suggestion
  • form{“name”: “form_suggestion”}
  • form{“name”: null}
  • utter_goodbye


  • give_suggestion
  • utter_request_suggestion
  • deny
  • utter_goodbye


what is action_fetch_user in story_suggestion 01