Is there any way to trigger a custom action from button payload?
You can use the Mapping Policy to map your intent to an action and then use this intent as payload in your button.
@saurabh-m523 Is there a way to add this to your already trained model without having to retrain the nlu part of your model?
Not that I know of.
Is there any news on this, especially given that the MappingPolicy has been deprecated?
Hi @saurabh-m523, do you know how to trigger a custom action using button payload with a slot value in rasa 2.x?
@jhzape You can use the below in your response:
utter_example:
- button: payload: /intent_name text: ‘Test’
Then in your stories.yml or rules.yml you can write a story or rule which trigger an action based on given intent as below:
- intent : intent_name
- action: action_name
And your action should be added in the domain file.
Hi @MariamHar thanks for the reply. I am still not sure, if you mean after /intent_name, I should give the slot_name and values in the same line? Not works for me in that way.
@jhzape there is no need to add the slot values here, intent_name is the name of your intent.just replace intent_name with intent you are getting from the user and action_namw with the action you want to trigger for this intent.
Hi @MariamHar, I may misuse the buttons, since I tried to use the same payload for buttons with different slot values.
I got the same issue. I was thinking, you can predefine an intent and a slot for a button. Is this possible?
Yes, for example, ask weather, and you can choose from the buttons which city you are looking for. But at the moment I have no idea how to implement them and simply add different intent to each button.
Hey I found a solution how to set a slot by clicking a button. You need to put the entity and value in a json object right behind the intent. For example:
buttons= [{"title": title_of_the_button, "payload": "/intent " + json.dumps({entity: value})
So if your slot is called like the entity in the code above, the slot will be set.