How to show videos in Rasa?

Like images how to show video in Rasa

It depends on what frontend you are using. In case you are using rasa-webchat, you can send video like this:

dispatcher.utter_message(attachment={
            "type": "video",
            "payload": {
                "title": "Rasa Masterclass",
                "src": "https://www.youtube.com/embed/-F6h43DRpcU"
            }
        })
2 Likes

@saurabh-m523 bro I want to deploy my Rasa chat into my own website. How to do it?

I put this in actions file it wasn’t working.

Could you please post that custom action?

dispatcher.utter_message(attachment={
            "type": "video",
            "payload": {
                "title": "Rasa Masterclass",
                "src": "https://www.youtube.com/embed/-F6h43DRpcU"
            }
        })

Where to put the above code bro?

You put it inside the run method of your custom action.

from typing import Any, Text, Dict, List

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


class ActionYoutubeVideos(Action):

    def name(self) -> Text:
        return "action_youtube_video"

    def run(self, dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:

        #dispatcher.utter_message(text="Hello World!")
        dispatcher.utter_message(attachment={
            "type": "video",
            "payload": {
                "title": "Watch Below Video",
                "src": "https://www.youtube.com/embed/-F6h43DRpcU"
            }
        })

        return []

Now what should i do bro?

Now if you talk to your bot via the rasa-webchat component and if this action gets called, you should be able to see the video embedded within the webchat.

1 Like