How to send an attachment via dispatcher?

Can anyone give a snippet of how to do this ?

@Sherin-Sneha What attachment you looking at text, video, button, image etc


`dispatcher.utter_message(text="Hello 😀")`


dispatcher.utter_message(text="Here is something to cheer you up 😉", image="")


                      "title": "great",
                      "payload": "great"
                      "title": "super sad",
                      "payload": "super sad"

   dispatcher.utter_message(text="Hey! How are you?", buttons=button_resp)


msg = { "type": "video", "payload": { "title": "Rasa 14 Series Premier Video", "src": "" } }

dispatcher.utter_message(text="Check this video",attachment=msg)

Hope this what you looking and solve you issue.

1 Like

So here in Video: we have msg, type: video and src as link right !! In my use case, I have to send a csv file which is in my system directory … so instead of msg do I have to change anything else, what should I give the type as and how to give the location of my file in the directory in src

If the csv file is small, u can send the csv content like this :
dispatcher.utter_message(text=Path("xxx.csv").read_text()). But this is not a good way to send big data by rasa server, u need a file server, and just send the csv file address,like the video msg, use a url

1 Like

You have any idea how to use the server file because my file is kinda large and I am using telegram channel to give the output, so will I be able to give the csv file to the user to download and use… I didn’t actually get what needs to be done in the server file!! Would be helpful if I could get a snippet of how this could be done

You can build a file server with python, a sample guide. And you can buy a file server , like amazon or others

what would be the data type then ? shall we use “csv” , text, …

@nik202 Hello, I would like to know how i can send a URL as a response via dispatcher. Thanks in advance


dispatcher.utter_message(text=" following is the website [link] (https:")


website= [link] (https:
dispatcher.utter_message(text=" following is the website link:", attachment=website )


Good Luck!

Thankyou @nik202 , but i have tried exactly the same and it isnt working. I am getting a blank output as response from the chatbot. The text is being printed but the link isnt being printed.

@Meenu1 what is your frontend?

Hi @nik202 , im very sorry for the late reply I have used angular for front end. Why do you think this issue is occuring and why isnt attachment parameter not working?

@Meenu1 I will recommend testing your bot using Rasa X whilst using the same method using domain not using custom action. Much of these things depend on the front end. I can be wrong but normally I am not. Good Luck!

Thankyou @nik202 , i have figured it out. The problem was with the front end [html, angular]. I had to make changes in the way i send my output through the dispatcher. Changed it this way: → dispatcher.utter_message("<a href'"+ urls_list[i]+ "'> Click here to open the link</a>")

This has worked for me

@Meenu1 great, I told you much of this stuff depends on the front end. Remember if you switch to another front-end maybe it will not work. Best N

1 Like