How to create attachment uploading and downloading in rasa

Hi All,

We can do this using custom channel or custom connector. In that we can pass extra parameter from our request body into metadata field.

request payload:

{
        "sender": "username",   
        "message": "are you a bot?",
        "metadata":{
            "name":<file_path> or <entire file object>
        }
}

custom channel code snippet:

my_connector.py file : my_connector.py (5.5 KB)

credentials.yml code sniipet:

credentials.yml file : credentials.yml (808 Bytes)

custom action server code snippet:

actions.py file: actions.py (1.1 KB)

At the end after getting file data from custom action we can store it wherever we want, either we can store it to local database or we can pass it to any API for storing it onto a different location.

Hope that helps :blush:

1 Like