Giter Club home page Giter Club logo

go-slack-poll's Introduction

Go-slack-poll

Go Report Card

A simple Slack app that provides multiple-choice polling functionality. Users can vote for one or more choices by clicking on buttons in an interactive Slack message created by the bot using a Slack slash command.

Adding the pollbot to your Slack workspace

Before you begin, you'll need to have the bot running at a publicly accessible domain. Prefereably, you would have a reverse proxy or load balancer with HTTPS support in front of the bot.

  1. As a Slack admin, browse to https://api.slack.com/apps and click on [Create New App]
  2. Give the app a name (ex. "Poll Bot") and select the Slack workspace it should be connected with. Click [Create App]
  3. Under "Features" select "Interactive Components"
  4. Turn on "Interactivity" and fill in the "Request URL" with your bot's domain name, followed by /interaction:
    https://yourdomain.com/interaction
    
    and [Save Changes]
  5. Under "Features" select "Slash Commands" and [Create New Command]
  6. Pick a clear name for the command (ex. "/pollbot") and for the Request URL enter your bot's domain, followed by /command:
    https://yourdomain.com/command
    
    For "Short Description", enter "Creates a poll". For "Usage Hint" enter:
    "Title" "Choice 1" "Choice 2" ...
    
    Make sure "Escape channels, users, and links sent to your app" is enabled, and [Save]
  7. Under "OAuth & Permissions", make sure your app has chat:write:bot and commands permissions. Click [Save]
  8. Under "Settings" select "Install App" and [Install App to Workplace]

Starting the pollbot

Go-slack-poll uses Redis for persistence of its polls. If you have Docker and the docker-compose utility installed, you can easily spin up all of the necessary infrastructure from the command line. From the root of this repo, run:

$ SLACK_SIGNING_SECRET=YourAppSigningSecret docker-compose up

Starting the pollbot with Kubernetes and Helm

The pollbot and supporting Redis cluster can easily be installed on an existing Kubernetes cluster using Helm from the chart included in this repo. Once you have helm installed, run:

$ helm install ./helm/go-slack-poll \
    --name go-slack-poll \
    --set env.slackSigningSecret=`echo "YourAppSigningSecret" | base64`

Creating a poll in Slack

You can create a poll in Slack using the /pollbot command (or whatever slash command you have configured in your Slack app settings):

/pollbot "Is this pollbot just the best?" "Yes ๐ŸŽ‰" "No ๐Ÿ™"

go-slack-poll's People

Contributors

chris-hamper avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

ricsipontaz

go-slack-poll's Issues

Can't use more poll options than 4

Hi!

First, thanks for your work, it's really useful. :)
But I've found a small issue. You can't use more poll options than 4 (+1 Delete button).
It's a Slack limitation: https://api.slack.com/docs/interactive-message-field-guide

A collection of actions (buttons or menus) to include in the attachment. Required when using message buttons or message menus. A maximum of 5 actions per attachment may be provided.

As a workaround the apps can use multiple attachments. Is there any chance you can modify your code to handle this scenario as well? :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.