RocketChat / Apps.Rasa

Integration between Rocket.Chat and the RASA Chatbot platform
17 stars 12 forks source link

Rasa App not sending images to livechat #38

Open thecion opened 3 years ago

thecion commented 3 years ago

Hello ppl, I'm having a problem trying to work with images in livechat through RasaApp.

This appears to be happening only when using a Rasa Bot with RasaApp, since I can send images to the user by myself and the user can reply with another image during a "normal" conversation.

Testing:

01_image_rocketchat

02_image_livechat

03_livechat_rocketview

My questions are:

  1. Should RasaApp work with linked images?
  2. If not, how should I send files to the App API POST incoming?

Best regards.

murtaza98 commented 3 years ago

Hey @thecion Unfortunately the app isn't handling media properly :disappointed: and there is definitely room for improvement there.

Could you help me by confirming the payload which the Rasa rest api returns back to the app if it has a image response?

[
  {"text": "Hey Rasa!"}, {"image": "http://example.com/image.jpg"}
]

Also any idea what other types of files can be shared by the Rasa bot so I can add support to that as well?

thecion commented 3 years ago

Hello @murtaza98 , thanks for your quick reply and I appreciate your effort in making this App even better.

Could you help me by confirming the payload which the Rasa rest api returns back to the app if it has a image response?

First, I have some logs from our Rasa server:

From what I understand Rasa sends an URL of the image, not the image itself. I could be wrong here (if anyone wanna correct me it would be very helpful =) ), but it seems RocketChat is the responsible for showing the image to the user.

Rasa is using the chat.postMessage endpoint from RocketChat API, as show in its DEBUG log:

2021-07-02 13:50:56 DEBUG    urllib3.connectionpool  - Starting new HTTP connection (1): 192.168.100.54:3000
2021-07-02 13:50:56 DEBUG    urllib3.connectionpool  - http://192.168.100.54:3000 "POST /api/v1/chat.postMessage HTTP/1.1" 200 None

I'm able to replicate the message Rasa sends by sending this to the RocketChat API.

{ 
    "channel": "#channelname or string id",
    "attachments": [
        {
        "image_url": "https://images-na.ssl-images-amazon.com/images/I/71dhm1tcD%2BL._AC_SL1500_.jpg"
        }
    ]
}

Also any idea what other types of files can be shared by the Rasa bot so I can add support to that as well?

In our case I believe image files like PNG, JPG, GIF are the most common. Since these bots usually work in small chat windows I don't think people would send anything too big (well I wouldn't anyway :P ).

murtaza98 commented 2 years ago

Please check if this comment is helpful here -> https://github.com/RocketChat/Apps.Rasa/issues/37#issuecomment-1117441330