Skip to content
Austin (Xu) Wang edited this page May 9, 2020 · 1 revision

What's Rich Message

There are some discussion regarding rich message https://forums.rocket.chat/t/supporting-rich-chatbot-messages-menus/528/40

However in the official document there is no such description.

richmessage is not the plain text message, but it can be a clickable image, or a button. So the receiver can click on the message to visit some website or speak something defined in the message.

How to do it

using the postmessage API https://rocket.chat/docs/developer-guides/rest-api/chat/postmessage/

Follow the rule to construct the attachments field. below is one example

att = [{
      "title": "text button with msg in chat window",
      "actions": [
        {
          "type": "button",
          "text": "Say hello in chat window?",
          "msg": "hello in chat window",
          "msg_in_chat_window": True
        }
      ]
    }]

rocket.chat_post_message("Title", channel='robotest', alias='Robot-Kai', attachments=att).json()

Notice the text field, "Title" in the example above, is not necessary, the post message API can be without text(only attachments).

Clone this wiki locally