Passing Payload's across custom actions having custom buttons

My scenario is as following. There are 2 custom action classes namely persons and person as below and trying to pass person_name from persons to person.

Action file

class ActionPersons(Action):
    def name(self) -> Text:
        return "action_persons"

    def run(self, dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
        buttons = []
        buttons.append({"title": "Person-1", "payload": "/person"})
        buttons.append({"title": "Person-2", "payload": "/person"})
        msgStr = "test"
        dispatcher.utter_button_message(msgStr,buttons)
        return []

class ActionPerson(Action):
    def name(self) -> Text:
        return "action_person"

    def run(self, dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
        print(tracker.latest_message)
        print(tracker.slots)
        print(tracker.events)
        print(tracker.latest_action_name)
        print(tracker.sender_id)
        print((tracker.latest_message)['text'])
        dispatcher.utter_message("Person name is")

domain file

intents
- persons
- person

actions:
- action_persons
- action_person

slots:
  person_name:
    type: text

stories.md has following

* persons
  - action_persons
* person{"person_name": "kk"}
  - action_person

I am unable to pass person name across the custom classes. Let me know how to do it.

1 Like

Folks, any help here ?

I am stuck here. Any help would be great.

Hi @kkbrat9 you need to store this in a slot to be able to access it from a different action, you can use the SlotSet event: Events

@akelad Thanks for the response.

Still i don’t understand on how to use the Events for my my as in the above example. If you see, i am looking for which button the user has chosen and both the buttons has the same payloads (calling action_person). Can you pls update a sample code ?

@akelad Any help here ?

Did you find the solution…?