Send files to bot

Is it possible to send files to the bot? Most chat clients have a button to send an image or a file but I don’t know if it is possible for the bot to receive it. Any ideas? :slight_smile: Of course I’m interested in all file types.


You can put the files in S3 or NFS like that and send the link/bool to rasa core that perceives that it has received a file.

another option would be to store the byte stream in the tracker itself though I am not sure it is a good idea.

All you need is some sort of indicator that you provide to the bot that you have received a file, unless you want the NLU to parse the file itself for information but that also you should do with a different API, bot should process relevant natural text or slots that alter the direction of the conversation

1 Like

Assuming you are building your own bot that has designed a custom UI that interacts with RASA, why not ? However you have left out a key part as to what is the Bot to do with the file - If it just says got it and save it somewhere , its probably better to do this in your code and just send the bot something like /uploaded{file:“xyz”} and then have the bot do whatever. If you want the bot to do something based on the contents of the file , I 'd think you probably are still better off saving it somewhere and then passing a reference to the bot so that a custom action could still read its contents and do whatever you want to do.

If you are integrating with something like Slack - Im guessing that the current out of box implementations dont handle it and would need to be extended.

1 Like

I have not settled on a platform (either commercial or cursom made client) but I’m testing in Telegram. I wonder if and where the file is stored on Telegram, and if I can get the file metadata from the dialog state tracker.

For now I just want the bot to receive the file and possibly move it to a different server. No parsing / analysis, orther than verifying the file extension (jpeg, pdf, etc.).

What are S3 and NFS?

sorry no idea about Telegram , probably you will have to check the APIs e.g.

This is how the Facebook channel does it for audio messages that are sent as attachments

elif self._is_audio_message(message): attachment = message[‘message’][‘attachments’][0] text = attachment[‘payload’][‘url’]

i.e. the messenger itself sends you a URL representing that file - what you do with that URL can be in your code. To the bot you will usually send in the reference to this file. So for e,g, you could create your own Telegram channel , and when you get a file , you could save it to wherever you want and send an ID or URl in an event to your bot which indicates that the user sent something and then act on that.

S3 is amazons cloud based storage system NFS is network file system i.e. you can access files on the network as if they were local.

Thanks I will take a look at your links. I would also presume that telegram sends an URL to the file.

Hello @souvikg10 and @Krogsager,
I want the rasa bot to generate a file (such as .csv) and send it to me on telegram. Is it OK? How to implement it?

any suitable example for reference

Hi Souvik,

I am working on a project using Rasa for creating a Fault Logging Chatbot. I want the user to be able to upload a picture of the fault. So the picture can be sent directly to a database. Do you have any idea how to figure this out