Giter VIP home page Giter VIP logo

quanti-slack-poll's Introduction

/Quanti Slack Polling App

GPLv3 License Issues

/quanti is a free Slack app created by Quanti to ask & answer simple polling questions in a Slack workspace. You can use this little buddy right now, just download him from here.

/quanti is open source (licensed under GNU GPL v3), and you can use him to help you decide anything: where you'll be eating for lunch, what time your friends or colleagues want to meet up, ...

Slack

  1. Go on https://api.slack.com/apps. Then create a new app in Slack.

  2. Give it a name and associate it to a Slack domain

  3. Select Slash Commands and click Create New Command

  4. Set your slash command settings to https://{yourdomain}/post

  5. Select Interactive Components and add a request https://{yourdomain}/actions

  6. Select OAuth & Permissions and click Install App to Workspace

  7. Add redirect url : https://{yourserveraddress}/slack/auth/redirect

  8. Get your workspace token

  9. Scroll down to Scopes and sets your workspace rights

    • chat:write:bot
    • chat:write:user

Database

  1. Install mongodb

  2. Set your database url in env var.

    export DATABASE_URL="mongodb://127.0.0.1:27017"
    
  3. Set your database name in mongodb and then in env vars too.

    export DATABASE_NAME="myPollDb"
    

Server

  1. Create a Unix server and install:

    • node: 10.x.x
    • npm: 6.x.x
  2. Clone the repository on your server.

  3. Go at the root level of your repository and then install package dependencies

    npm install
    
  4. Set SLACK_APP_OAUTH environment variable with token that you got at step 6 from the Slack configuration guide.

    export SLACK_APP_OAUTH=xoxp-xxx-xxx-xxx-xxx
    
  5. Set SLACK_APP_TOKEN environment variable with token that you can get on your Slack application management interface. Go to Basic Information then scroll down to App Credentials and gets the Verification Token value.

    export SLACK_APP_TOKEN=xxxxxxxxxx
    
  6. If your app is not distributed you'll have to disable the team authentication

    export DISABLE_SLACK_TEAM_AUTH=1
    

    Otherwise:

    export DISABLE_SLACK_TEAM_AUTH=""
    
  7. Set the server PORT

    export PORT=6463
    
  8. Install and run certbot to generate the SSL certificate

    sudo apt install certbot
    
  9. Once SSL cert is generated:

    • set SSL_KEY to your privkey.pem path
    • set SSL_CERT to your cert.pem path
    • set SSL_CHAIN to your chain.pem path
  10. Install PM2 with npm

npm install --global pm2
  1. Register and launch your application with pm2

  2. Go back to the slack app interface and go to Manage distribution and click to the slack button and proceed to the installation

NOTES: Do not forget to launch PM2 and exports variables at startup.

Usage

To create a simple poll you can specify question and responses like this: /askia Drink? Wine Beer Pastis Water

If the question or the responses contains space they must be wrapped between quotes " characters like this:

/quanti "What ya wanna drink?" "IPA Beer" "Stout Beer" Other

If a response is too long to be displayed as button or if you simply don't want to repeat the whole text of your response in a button. You can select the part of your text that will be displayed as button by using @label{}. in the response text:

/quanti "What ya wanna drink?" "Double @label{IPA}" "Milk @label{Imperial Stout}"

--limit

/quanti "What ya wanna drink?" Wine Beer Scotch Pastis Water --limit 1 Sets a limit of responses that a user can votes for. When set to 0 no limit is applied. Default value is set to 0.

--expires

/quanti "What ya wanna drink on Friday?" Wine Beer Water --expires "1d 2h" Sets the times before users votes will expires. The times can be expressed like this:

  • for 1 day 1d
  • for 2 hours 2h
  • for 10 min 10min
  • for 30 seconds 30s

--anonymous

/quanti Drink? Wine Beer Water --anonymous The name of users will not be displayed while they vote--no-anonymous-label/askia Drink? Beer Water --anonymous --no-anonymous-labelWhen the anonymous flag is set, hides the anonymous poll quote at the end of the poll message.

/quanti is licensed by Quanti - Quantitative Research under GNU GPL v3.

Contributing

You are welcome to create issues for this project; could they be bug fixes and/or feature requests. In such cases, due to limited availability, we'd appreciate you provide in your issue:

  • The error message.
  • Slack environments (public / private channel, direct message, user group, user rights, ...)
  • Steps to reproduce the error.

We also encourage contributions via Pull Requests.

quanti-slack-poll's People

Contributors

djedj avatar uncleserb avatar zenifold avatar

Watchers

 avatar

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.