Rasa RocketChat channel not working with JSON

I keep getting this when I try to send JSON with utter_message…

File “/root/env/lib/python3.7/site-packages/rasa/core/channels/rocketchat.py”, line 84, in send_custom_json text = json_message.pop(“text”) AttributeError: ‘str’ object has no attribute ‘pop’

The message I am sending is:

dispatcher.utter_message(json_message=’{“title”:“test title”,“text”:“COOL!”}’)

Any advice would be much appreciated.

Hi @srocke! The json_message should be a dictionary. looks like you stringified your dictionary! Just removing the quotes should do it: Instead of

 dispatcher.utter_message(json_message='{"title":"test title","text":"COOL!"}')

try (notice the change in syntax highlighting!)

 dispatcher.utter_message(json_message={"title":"test title","text":"COOL!"})

That worked! Thanks! Now, if I could only figure out how to get RocketChat to stop stripping HTML from my messages in LiveChat, I would be done with this project! Any ideas there?

Oh gosh, i have no idea there :see_no_evil: don’t know anything about livechat/rocketchat’s frontend, sadly!

No problem. Thank you for getting back to me! Do you have any suggestions as to where to post in RASA forums for a possible answer?

Hm I would recommend either looking for support on livechat/rocketchat (not sure which one actually has the issue in this case), or searching for users who have posted about rocketchat in this forum and nicely asking if they’ve ever tried to add HTML to messages. I don’t think the greater Rasa community in general will know much about that specific issue!

Have you checked to see if HTML is even supported as a markup language in rocketchat/livechat? could be that they only support markdown or some custom format.

They just released an RC with UIKit support, so we will see what I can get done with that :slight_smile: Thank you for the pointers.

1 Like