Rocket.chat.reactnative: Add support for action buttons

Created on 25 Feb 2019  ·  15Comments  ·  Source: RocketChat/Rocket.Chat.ReactNative

  • Your Rocket.Chat Experimental app version: 1.9.0.5743
  • Your Rocket.Chat server version: 0.74.3
  • Device (or Simulator) you're running with: Mi A2 - Android Pie

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.

Currently the app is not rendering action buttons:
screenshot_20190225-093922
df-8498bc4e40f5.png)

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.

Most helpful comment

@diegolmello I will help with it.

All 15 comments

Depends on #405

@diegolmello I'm not sure it depends on that, since there is no UI involved.

@sampaiodiego you're right about not being UI.
In the other hand, it would be odd to have support for action buttons taps, but no support for creating a poll 🤷‍♂️

How can I send formatted pictures and text lists to the chat window?

How can I send formatted pictures and text lists to the chat window?

@alleniver didn't get what you're trying to do and why it's related to action buttons 🤔

haha! i'm just asking by the way.

There are even more action buttons than what @sampaiodiego described, we need documentation about them..

Slash commands are now implemented, are you going to work on this soon?

@lorek123 It's not planned yet.
Let me know if you want to help.

not anytime soon, but documentation would help.

@diegolmello I will help with it.

@oguhpereira Thank you, we really appreciate it! ❤️😁

It was deprecated and no longer necessary since UIKit was implemented.

@djorkaeffalexandre @diegolmello "attachment.actions" buttons are still not rendering, how do I use UIKit to render "Actions" and send message based on action click.

Hey @nishantt12, for now, I think we don't have a fully documentation about our available UIKit components, but you can check how to create apps here and can use one of our apps as a base to do your own app.
https://github.com/marceloschmidt/koko
https://github.com/sampaiodiego/rocket.chat.app-poll

Was this page helpful?
0 / 5 - 0 ratings