Rocket.Chat.iOS icon indicating copy to clipboard operation
Rocket.Chat.iOS copied to clipboard

[NEW] Add support to action buttons

Open sampaiodiego opened this issue 6 years ago • 2 comments

  • Your Rocket.Chat app version: 3.2.0 (221)
  • Your Rocket.Chat server version: 0.74.3
  • Device (or Simulator) you're running with: iPad

As the current state of Rocket.Chat Apps, they're using action buttons to interact with users, when clicking such buttons, a slash command is called.

This is how the app is currently rendering actions buttons: photo_2019-02-25_09-12-13

This is the web version for comparison: image

The buttons are on the second attachment.

Below is a compact version of a message object containing the relevant fields for action buttons:

{
  "_id": "ryWoB9zYFzWEaPABs",
  "rid": "XkhRGsh7SGkDJPkbj",
  "msg": "_Is poll app working?_",
  "attachments": [
    {
      "color": "#73a7ce",
      "text": ":one: Yes `0`\n:two: No `0`\n:three: Some times `0`"
    },
    {
      "color": "#73a7ce",
      "button_alignment": "horizontal",
      "actions": [
        {
          "type": "button",
          "text": "1",
          "msg_in_chat_window": true,
          "msg": "/vote cf4169ea-cab1-46a3-b798-dfddea2db474 0"
        },
        {
          "type": "button",
          "text": "2",
          "msg_in_chat_window": true,
          "msg": "/vote cf4169ea-cab1-46a3-b798-dfddea2db474 1"
        },
        {
          "type": "button",
          "text": "3",
          "msg_in_chat_window": true,
          "msg": "/vote cf4169ea-cab1-46a3-b798-dfddea2db474 2"
        }
      ]
    }
  ]
}

The key points here are the following:

  • the button_alignment of the attachment should be respected
  • if msg_in_chat_window is true, the text property should be used as the button value, and the msg property will be the slash command executed when tapped.

If you need more information, please just let me know.

sampaiodiego avatar Feb 25 '19 12:02 sampaiodiego

There are even more action buttons now. We need to work on documentation.

graywolf336 avatar Apr 26 '19 00:04 graywolf336

I use RC API to post a button message but it was not displayed. Please tell me if it's available.

lainguyenth avatar Sep 26 '19 08:09 lainguyenth