Take Input from User On Button Click

Hi

I have a use case to recommend courses to users. Whenever a Bot shows a course, it asks from user to “mark it as done on completion”. If user replies yes, bot will recommend next module. If user replies “No”. Bot will not recommend any other course

Bot - Here is new course for you "Machine Learning for beginners. " Mark it as Done : YesButton NoButton

User : Clicks yesButton Bot - show next module and so on Mark it as Done : YesButton NoButton

I checked this example mentioned in Rasa Docs

templates:

utter_greet:

  • text: “Hey! How are you?” buttons:
    • title: “great”

      payload: “great”

    • title: “super sad”

      payload: “super sad”

This will just show buttons on UI. But I want to take some action on these button clicks.How do I implement this solution?

Can anyone help on this?

1 Like

You probably already have an intent for yes/no. You can use a forward-slask ‘/’ to make the button behave as if a user said yes or no. E.g.:

"Mark it as Done"
      buttons:
        - title: "Yes"
          payload: "/intent_yes"
        - title: "No"
          payload: "/intent_no"

You can also assign slots and entities:

/food_category{"ent_foot_type": "soup"}

Thank you . I have implemented the same way as you mentioned… It was not clear from documentation that payload act as intent. Is there any way to define css for these buttons and text?

1 Like

hey !! How did you link the buttons with the UI because in my case the buttons did not appear so I have to create it with HTML and CSS and pay loaded when an intent is triggered

hey @r4sn4 can i know which channel you are using?

I am using custom channel

hey @r4sn4 so are you able to do the implemenation of Buttons in your channel?

Hey How did you connect it with your UI. I’m unable to do so. Please help