Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for action buttons #649

Closed
sampaiodiego opened this issue Feb 25, 2019 · 15 comments
Closed

Add support for action buttons #649

sampaiodiego opened this issue Feb 25, 2019 · 15 comments

Comments

@sampaiodiego
Copy link
Member

  • 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.

@diegolmello
Copy link
Member

Depends on #405

@sampaiodiego
Copy link
Member Author

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

@diegolmello
Copy link
Member

@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 🤷‍♂️

@alleniver
Copy link

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

@diegolmello
Copy link
Member

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 🤔

@alleniver
Copy link

haha! i'm just asking by the way.

@graywolf336
Copy link

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

@lorek123
Copy link

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

@diegolmello
Copy link
Member

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

@lorek123
Copy link

not anytime soon, but documentation would help.

@ogustavo-pereira
Copy link

@diegolmello I will help with it.

@djorkaeffalexandre
Copy link
Collaborator

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

@djorkaeffalexandre
Copy link
Collaborator

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

@nishantt12
Copy link

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

@djorkaeffalexandre
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants