Search code examples
rasa-nlurasa-corerasa

How to add buttons in RASA chatbot?


I want a chatbot with buttons for example, How are you feeling? Sad or Happy. I want two-buttons(one for happy and one for sad) here and get input from the user and followed by other questions. What will be the stories.md, nlu.md, domain.yml, and frontend python code?


Solution

  • For making a button the way you said, you have to change the domain.yml file only. In the templates section, after text add code like this.

    buttons:
    - title: "Happy"
      payload: "utter_happy"
    - title: "Sad"
      payload: "utter_cheer_up"
    

    With this, I will encourage you to check this GitHub repo to know about other types of chat bot Widget designed for Rasa Bots. https://github.com/JiteshGaikwad/Chatbot-Widget

    And in this repo, you will find some demo chatbots which are fully written in Python. https://github.com/cedextech/rasa-chatbot-templates

    Hope this helps.