Rasa webchat , buttons payload from actions.py

How can we send buttons payload from actions.py using dispatcher

Such that it shows the buttons in response

Please check the docs.

dispatcher.utter_message(buttons = [
   {"title": "Yes", "payload": "/affirm"},
   {"title": "No", "payload": "/deny"},
])
1 Like
from typing import Any, Text, Dict, List

from rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcher


class Actionservice(Action):
    def name(self) -> Text:
        return "action_service"

    def run(self, dispatcher: CollectingDispatcher,
             tracker: Tracker,
             domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
             #new
             buttons=[
                 {"payload":'/docs{"content_type":"docs"}',"title":"Documentation"},
                 {"payload":'/Audio{"content_type":"Audio"}',"title":"Audio call"},
             ]
             dispatcher.utter_message(text="What kind of service you want to use..!",buttons=buttons)
             return []

1 Like