RASA Attachments

Hi All,

In my use case I have to send an attachment to an API. Lets take example Bot : Do you have template User : Yes Bot : Please provide a template User: Upload the template of a file.

After this bot has to perform an action to perform a POST request sending the attachment. Can anyone help how to handle this . I am not able to understand how rasa_nlu is going to treat this attachment.


rasa_nlu should ignore the attachment. As for storing it, you should be able to in a custom action somehow, but it depends on the messenger platform you’re using.

I am using a custom UI. I have to fullfil a conversation by sending an attachment. Any idea how to achieve this. This attachment will be required to send an API request to some other application .

Thanks for the suggestion. I have been now able to handle such requests for now by passing attachment as a payload to RASA core.

1 Like

hey! could you brief how you achieved it?

Hi krati,

Instead of using server side scripting, I converted the attachment to a json in JavaScript and passed the data to the RASA along with message as payload and performed action as per my requirement

How have you done that?

When a message is passed to RASA core you can add a key. For example : { message : “your query”, payload: “attached data”}

In RASA core u can fetch it and act accordingly. this is the way I have done for my custom user interface. Also in my case , attachment is Excel or CSV so for me it is working

@vinayver198 can you help me to do the same using slack or skype

Hi @vinayver198

User will send two things as two separate messages-> message and then the attachment… and since Rasa treats each query as an individual query, how do I combine these two?

Also, I am posting my queries on “http://localhost:5005/conversations/default/respond” URL, on which URL are you posting {message: “your query”, payload: “attached data”}

Hi @rasa5, I made my custom server in order to achieve this using flask. Once you have created the server,you need to launch it. Also there will be certain condition on UI side that tells us whether file is uploaded or not. If file is uploaded we are going to capture those flags which will also be passed as payload. Once we have reached the server, the payload is decoded and necessary action can be taken .

Continuing the discussion from RASA Attachments:

Can you please tell me how to retreive the attachment or say payload in rasa? If possible, please provide me with syntax or example. Thanks.

1 Like

Hi! Has anyone figured it out: is it possible to attach files in Rasa X? Thanks!

Hi @vinayver198, Could you post the sample code? that will be very helpfull.