User Response Tracking in actions

want to get access to the payload values from my custom buttons. The main idea is to choose one option from the buttons, and then collect the payload values in a variable, in order to pass these to the next action.

The custom buttons are in a loop where from each items I collect the needed values for the “titles” and for the “payloads”. I want to achieve this in a dynamic way, since I have a lot of different variables with different length.

Here is my code until now:

def run(self, dispatcher: CollectingDispatcher,
         tracker: Tracker, domain: Dict[Text, Any],
     ) -> Text:
   for element in request.question.items:
   for l in element['choices']:
   buttons.append({"title": "{}".format(l['label']), "payload": "{}{}".format(element['id'],l['id'])})

   return [] 
dispatcher.utter_button_message(message, buttons)

Again, my question is how to access the selected payload values. In rasa x I can see that the payload is being selected properly, for example: “11,true”.

But I find no way to get these values into another variable. I also tried tracker.latest_message.get(‘text’) , but I only get the last user input.

Is there a similar function to “tracker.latest_message.get” for the last chosen button option or last utterance from bot?

Any help will be appreciated.

Thanks

def validate_vCode(
        self,
        value: Text,
        dispatcher: CollectingDispatcher,
        tracker: Tracker,
        domain: Dict[Text, Any],
) -> Dict[Text, Any]:
    """Validate cuisine value."""
    value=re.findall('\d+', str(tracker.get_slot('vCode')))
    value=''.join(value)
    vList=['343434','454545','545454']
    pdb.set_trace()
    if value:
        tracker.slots['vDetect']=SlotSet('vDetect','yes')
        tracker.slots['userQ']=SlotSet('userQ',tracker.latest_message.get("text"))
        if value in vList:
            print("vCode",value)
            # validation succeeded, set the value of the "cuisine" slot to value
            return {"vCode": value}
        else:
            return {"vCode": None}
    else:

when I submitting the form , the set slots are not populating. all are going to be None after filling the 2nd requested slot value.

Hi @Edukondalu, To your first question - the payload should be coming in as a user message; which version of rasa/rasa-sdk are you on? utter_button_message will be deprecated at some point (you should get a warning in a newer version) that’s why I’m checking. If you run rasa shell, what do your buttons look like when you reach that point in the convo? You should be able to see what payload it’s going to send back.

when I submit my buttons and entities are text then it is working fine.

am planing stop the form but again anything text value it is not stopping the story. so how can stop the story

interactive_story_29

  • greet
    • utter_greet
  • vendorProfile -vendor_profile_form
    • form{“name”: “vendor_profile_form”}
  • deny
    • utter_ask_continue
  • affirm
    • vendor_profile_form
    • form{“name”: null}
    • utter_slots_values
  • thankyou
    • utter_noworries

you’re missing action_vendor_profile_form to start the form flow. I’m not quite clear on the question you’re asking though?