File uploads wouldn’t be handled by Rasa. You’re UI component or a middleware layer in front of the Rasa channel would need to deal with the file and then initiate the dialog with Rasa.
The message to Rasa might include metadata that has the file name/url and state of the upload.
Can Rasa detect if the user input is of type file? I mean, if user sends a file to the Whatsapp bot, can Rasa detect that this is of type file and from there we can create some custom action to handle it?
Additionally, if the answer is yes, can we store the the input in slot and process it somehow?
You’ll have to look into the options for WhatsApp. There is no direct integration between WhatsApp and Rasa that I’m aware of because of the restrictions WhatsApp places on the use of their API. Here’s a recent post from another user.
Thank you for the response. @rudi I have done the integration of the bot using Twilio already. The next requirement was to receive a file from the user and store it in the database. I was looking into this rasa/twilio.py at master · RasaHQ/rasa · GitHub to see if I can make some use something to get the file that was sent.
That’s where I have no idea. I don’t think that you can have an intent work on media, intents work on text content only.
I think the best way to do this is a custom mapping, so that if there’s an attachment you can always trigger a custom action, before it gets to all the ML things.
You can see here in the Rasa Mapping Policy, how they check if it matches, then they set the action, and set the probability to 1: rasa/mapping_policy.py at master · RasaHQ/rasa · GitHub . So I was thinking that you could do a similar thing. Create a custom policy, that if there’s an attachment, it triggers a custom action with probability of 1.
If you want your bot automatically to save the files you send him or he receives, then uses “doc.download(for{path_to_your_directory}\{fileName}’)” I think that you won’t need extra information about the code for receiving files. It will be easier for you to use a management software for patients and customers. It will automatically save all the files you receive. After that, you will just enter your personal account and download them, or you can just save them on your account. I hope that I was even a bit helpful, and you will pay attention to my advice.