Setting slots with buttons when slot name != entity name

I have read on the forums that the way to set slots with a button is through the /intent{entity} format (as @akelad pointed out here: Slots Set By Clicking Buttons). However, I’m not understanding how the slot would be set if the slot name were different from the entity name. I would like to know if such functionality exists so I am avoid using custom actions unnecessarily. Here is how I currently defined my button in the domain:

  - text: "Please choose one."
      - title: "Take some time for yourself twice a week"
        payload: '/inform{"goal": "Take some time for yourself"}'
      - title: "Get up and get moving more"
        payload: '/inform{"goal": "Get up and get moving more"}'

Here, goal is the entity and the slot I’d like to be filled is called goal_recommendation.

@alexyuwen, you can simply change from goal to goal_recommendation on payload. Whenever the user clicks between one of those buttons, goal_recommendation slot will be filled with “Take some time for yourself” or “Get up and get moving more”. Retrain your model and try again. Hope it works


This works! Thanks.

1 Like

I am trying get the value from button which is actually sent to user from custom action.

def run(self, dispatcher, tracker, domain):
        user_vendor_name = tracker.latest_message.get('text')
        vs = VendorSimilarity()
        output = vs.get_vendor(name = user_vendor_name)
        for key in output["matched_vendor_name"]:
            buttons.append({"payload": "/user_vendor_name", "title": key})
        buttons.append({"payload": "/deny", "title": "I would like to add a new vendor"})
        dispatcher.utter_message(text="Please select a vendor:\n",buttons=buttons)
        user_vendor_name = tracker.get_slot('user_vendor_name')
        return []

Above is the custom action code. User will make a selection using buttons and I want to save that value in a slot to use it again in future. Could you help please?

Hi did you find a viable solution to your query? If yes, please share the info/snippet code here. thanks in advance!

Yes i got it working. Pls follow Marcos explanation. I will try to post the code snippet as soon as I find it.

No worries, I got it working too!