How to upload attachments through the rasa bot and send to the server?

I wanted the following conversation to be executed in the bot.

User : I want to upload the files

Bot: Displays Attachments button

(User clicks on the button and chooses the file from his local system to be uploaded )

Bot: (displays the file choosen by the user and uploads that to the server by http POST request)

Kindly help solve this Usecase.

PLease

Thanks & Regards,

Vaidehi

Vaidehi, welcome to the Rasa forum.

The bot could present the buttons but from the point where the user clicks the upload this would need to be handled by your UI (React component or UI of your choice). Also, you would not be uploading the file to Rasa (this is not a chatbot feature). You’ll need another service to handle the file.

If the file is related to your bot dialog, your UI could issue an intent possibly with an entity set to the file name or other metadata associated with the uploaded file. You might send the intent on completion of the upload to continue the dialog.

Greg

Yeah… Okay thanks a lot !

Hi @vaidehi16, any luck implementing this feature ?

Hi Stephan, how are you sending the attachment to the bot? are you using the metadata? How are you retrieving it in the bot?

You wouldn’t send the attachment to Rasa. You would upload the attachment somewhere (like an s3 bucket). You could then send Rasa something like this:

Here is my picture id https://my-bucket.s3.us-west-2.amazonaws.com/puppy.png

or

/upload_id{"id_url": "https://my-bucket.s3.us-west-2.amazonaws.com/puppy.png"}

Use a regex for the URL.

Thanks, I am not allowed to store the attachments anywhere. They are to be sent to RASA on the fly without storing them.