simple-slack-api icon indicating copy to clipboard operation
simple-slack-api copied to clipboard

Support for Slack Action optional fields and Confirmation fields.

Open BobbyJohansen opened this issue 7 years ago • 6 comments

I am going to write this as a tiny little functionality spec.

Currently SlackAction is lacking the following fields:

  • style : Type String (Should have an enum ActionStyle: default, primary, danger)
  • confirm: JSON hash of SlacActionConfirmation

Missing ability to create SlackActionConfirmation with the following fields:

  • title: String
  • text: String
  • ok_text: String : Defaults to Okay
  • dismiss_text: String : Defaults to Cancel

Slack updateMessage also only takes string text as a parameter instead of allowing for a more complex SlackPreparedMessage as an updated message.

It would be nice to also abstract out the rest endpoint and shove the request body a message for a listener to pick up and respond to. The ways that slack offers responses (json response to request, post to the provided hook url, or a chat update with an id) would be nice to abstract out too so that the listener just responds on event and depending on the time it took, the appropriate response route to slack would be taken.

BobbyJohansen avatar Oct 26 '16 15:10 BobbyJohansen

I've done the first bit of this as I needed it for a project: https://github.com/Ullink/simple-slack-api/pull/145 (merged)

GingerGeek avatar Nov 08 '16 16:11 GingerGeek

So, at the moment I can make a button but I can't get any response from it (whether it was clicked or not)?

Defozo avatar Jan 06 '17 00:01 Defozo

You need a registered rest end point to get the response.

On Jan 5, 2017 7:45 PM, "Michał Kiełtyka" [email protected] wrote:

So, at the moment I can make a button but I can't get any response from it?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Ullink/simple-slack-api/issues/143#issuecomment-270800753, or mute the thread https://github.com/notifications/unsubscribe-auth/AE1TR6oENZTblOqIK0b-C-8bAaJiXDkJks5rPY6kgaJpZM4KhWjq .

BobbyJohansen avatar Jan 06 '17 01:01 BobbyJohansen

I'm a bit lost in configuring that. I know that there's a place in configuration of Slack's app for that (Request URL in "Interactive Messages") but then, how can I attach my bot to my Slack's app? It looks like there's only support for Web API there. Am I missing something?

Defozo avatar Jan 06 '17 01:01 Defozo

You need to register your bot as a slack app. I use oauth flow to request bot scope for the app and on top of that set the redirect url for authentication and a url for slack actions aka buttons when they are clicked. You also will recieve a validation token for actions so you can validate the incoming rest requests are actually from your buttons. You can respond using the slack session object if you can respond fast enough otherwise you have to use the chat.post or message.post command (can't remember what it is called of the top of my head)

On Jan 5, 2017 8:29 PM, "Michał Kiełtyka" [email protected] wrote:

I'm a bit lost in configuring that. I know that there's a place in configuration of Slack's app for that (Request URL in "Interactive Messages") but then, how can I attach my bot to my Slack's app? It looks like there's only support for Web API there. Am I missing something?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Ullink/simple-slack-api/issues/143#issuecomment-270807466, or mute the thread https://github.com/notifications/unsubscribe-auth/AE1TR5d4qu8MaK_TbyFrtAA5GGzlXhD4ks5rPZkCgaJpZM4KhWjq .

BobbyJohansen avatar Jan 06 '17 01:01 BobbyJohansen

It would be nice if we can have example in examples folder. I'm trying to get this information pieces by pieces. This class have example of Token request, but it's still not clear. According to official slack docu - only apps can create buttons, not bots.

saikek avatar May 19 '17 13:05 saikek