poshbotio / PoshBot

Powershell-based bot framework
MIT License
540 stars 108 forks source link

Feature Request: Interactive Message Buttons #94

Open dbr787 opened 6 years ago

dbr787 commented 6 years ago

https://api.slack.com/docs/message-buttons

It would be great to be able to display interactive message buttons for things like command approvals, command options, and even just an 'Are you sure?' where appropriate. Some of the examples use '--force' to ask the user if the command is correct, buttons would be much nicer.

Just wanted to check if this is being considered or worked on? Maybe it's already possible!? But I can't find any examples on how to implement.

devblackops commented 6 years ago

@dbr787 It's currently no possible but I agree, it would be great if PoshBot supported two way communication in some way.

The challenge will be a few things:

  1. Slack's interactive messages require a public HTTPS endpoint for Slack to send action responses to. Currently, the Slack backend makes an outbound connection via websocket so no public endpoint is needed. Perhaps the Azure Function + Service Bus method could be used similar to the Teams backend to avoid the need of exposing PoshBot directly on the internet.

  2. Some way of defining what PowerShell functions in the plugin to execute in response to those actions.

  3. Those PowerShell functions will need relevant data from Slack to tie the action response to the original message the user invoked.

I definitely want to support this but haven't spent a lot of time on it yet.

BTW...command approvals are already supported (but not with buttons). http://docs.poshbot.io/en/latest/guides/command-approvals/

mgeorgebrown89 commented 5 years ago

@devblackops Would this be possible to do if we leveraged Set-PoshBotStatefulData? For example, send a message to the channel and enter a wait-loop until the Get-PoshBotStatefulData field is populated with a value, and have a certain timeout before quitting? I haven't look enough into the source yet, but I have a similar function where I watch the status of workflows and send messages back as they change or if they fail.

Also, in order to use the interactive messages, you have to have a "Slack App." Is this possible to do with PoshBot? or is this what you meant above by exposing it directly to the internet?

FISHMANPET commented 5 years ago

Reading between the lines, it kind of sounds like maybe this is really an "up for grabs" issue about making Poshbot work as a Slack App. Or if that's desirable maybe there should be a separate issue for tracking whatever work that would entail?

My work just got Slack and I'm excited to dive in with chat ops and contributing to this project, and so I'd be willing to get started making poshbot appable.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.