Displaying Video in the Rasa Webchat - Getting Started with Rasa / Tutorials, Resources & Videos - Rasa Community Forum

👋 Introducing the Rasa Playground

Displaying Video in the Rasa Webchat

Hi all,

If you want to display the video in the Rasa Webchat, just follow the below steps and you can get the below output:

Note: if you are sending youtube link, You must ensure the URL contains embed rather watch as the /embed endpoint allows outside requests, whereas the /watch endpoint does not. stackoverflow reference.

sending video attachment from domain.yml

  utter_greet:
  - text: "Hey! How are you?"
    attachment: { "type":"video", "payload":{ "src": "https://youtube.com/embed/9C1Km6xfdMA" } }

sending video attachment from actions.py:

class ActionHelloWorld(Action):
    def name(self) -> Text:
        return "action_hello_world"
    def run(self, dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
        msg={ "type":"video", "payload":{ "title":"Link name", "src": "https://youtube.com/9C1Km6xfdMA" } }
        dispatcher.utter_message(text="Hello World!",attachment=msg)
        return []

Reference: Sending video message

I hope this helps !

Thanks.

post by skjainmiah on Apr 2, 2020

@JiteshGaikwad bro when I send attachment from domain file it wasn’t show me anything and when I send attachment from actions file it showing error like this:

Error: "Expected type 'Optional[str]', got 'Dict[str, Union[str, Dict[str, str]]]' instead "

How to solve this issue also I cannot see the video displaying on the chatbot.

post by JiteshGaikwad on Apr 2, 2020

how are you sending the message from domain.yml file?

post by skjainmiah on Apr 2, 2020

I just added this to my domain file:

utter_video:

It causing no error but I didn’t show any video but when I use the code in action file:

class Video(Action):


def name(self) -> Text:
    return "action_video"
def run(self, dispatcher: CollectingDispatcher,
        tracker: Tracker,
        domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
    msg={ "type":"video", "payload":{ "title":"Link name", "src": "https://security.dimabusiness.com/img/icon/Dima_video.mp4" } }
    dispatcher.utter_message(text="Hello World!",attachment=msg)

return []

I’m getting error: Error: "Expected type ‘Optional[str]’, got ‘Dict[str, Union[str, Dict[str, str]]]' instead "

post by sibbsnb on Apr 24, 2020

have you customized the video size?

post by ramesh-ai on Jun 9, 2020

I was trying to add this video feature but i am facing issue.

After i add the domain.yml code and run what i have observed is, it changes the format as follows

utter_video: – attachment:

  payload:
    src: https://youtube.com/embed/9C1Km6xfdMA
  type: video
text: Hey! How are you?

And when I interact with the bot i get a blank page.

post by rahul_namdev on Jun 26, 2020

Hi ! I’m trying to do the same . Can you tell me how to customize the video size?

post by mounika2 on Nov 29, 2020

@JiteshGaikwad Hi jitesh, YamlValidationException: Failed to validate ‘C:\Users\m\Desktop\MovieBot\domain.yml’. Please make sure the file is correct and all mandatory parameters are specified. Here are the errors found during validation: in C:\Users\m\Desktop\MovieBot\domain.yml:23: Key ‘attachment’ was not defined. Path: ‘/responses/utter_greet1/0’

I am getting this error if used in domain.yml file

If I did using custom actions didn’t get any error but as well didn’t get any video response on chat UI. please help me on that.

post by ChikkaUdayaSai on Dec 28, 2020

hi @mounika2, how are you able to use quick replies and videos in Rasa 2.0. Can you provide sample domain file.