1

I'm trying to have my backend create a poll for a given user and when the user responds to the poll receive the response on the backend. However I cannot find a way to do the second part with an API available.

I know I can use Incoming Webhooks to send a command to users slackbot channel: /poll .. ... ... however I'm unsure how to receive a response from when user selects one of the options in the poll.

Sterling Duchess
  • 1,970
  • 16
  • 51
  • 91
  • Please be more specific, e.g. how does the user currently select options?. Please also share your current code – Erik Kalkoken Feb 05 '18 at 15:23
  • @ErikKalkoken I don't have a current implementation as I'm not sure how to go about it. One idea was with incoming/outgoing web hooks. The user would receive a simple poll on their slackbot channel as you do with `/poll` however when you click on a option on the poll it would send a response to a server. – Sterling Duchess Feb 06 '18 at 07:18

1 Answers1

3

OK, one approach would be

  • Slash command for the /pollcommand, it will send a request to your app every time a user enters the command
  • Your app can then sends the actual message containing the poll details back to the channel incl. message menus simply by responding to the slash request or with Web API e.g. chat.PostMessage
  • User chooses polls option from message menus. Chosen option is send back to your app by Slack.

This is just one approach. Alternatively you could also show the options as message buttons or open a Dialog for the user.

I would advise against using outgoing webhooks, since its no longer part of the main features (and slash commands and interactive menus will send a request directly to your app anyway). Also Web API / chat.PostMessage is better than Incoming webhooks.

Erik Kalkoken
  • 30,467
  • 8
  • 79
  • 114