Giter Site home page Giter Site logo

mtbpoll's Introduction

Votey

a simple slack polling slash command - because paying for polls is kind of stupid

Votey Screenshot

Deploying for Production

Deploy

  1. Click the Deploy button above, and then create a new Slack app and scroll down to the App Credentials Panel.
  2. Once the application has deployed on Heroku, head to the Settings tab, and scroll down to the Config Vars section. We'll need to fill out some variables that are generated upon creating a Slack App:
    • CLIENT_ID - Client ID of your Slack App
    • CLIENT_SECRET - Client Secret of your Slack App
    • SIGNING_SECRET - Signing Secret of your Slack App
    • FLASK_ENV - should be set to production
    • DATABASE_URL - this should automatically be set to your postgres database uri
  3. Click into the Interactive Components panel (Interactivity and Shortcuts on the sidebar)
    1. Toggle this feature on in the upper right hand corner
    2. Fill in the Request URL to https://your-app.herokuapp.com/slack (the /slack part is what's important).
  4. Go back, and Click into the Slash Commands panel (also found on the sidebar)
    1. The command name can just be votey, or whatever you'd like to use to trigger the bot. Again the Request URL should be https://your-app.herokuapp.com/slack (remember, the /slack part is what's important).
  5. Go back, and Click into the Permissions panel (OAuth & Permissions on the sidebar).
    1. Add a Redirect URL: https://your-app.herokuapp.com/oauth.
    2. Add Permissions under the Scopes Panel, and enter:
      • chat:write
      • commands
  6. Finally, we're ready to connect Slack with our bot. Navigate to Manage Distribution on the sidebar, and click Add to Slack. This should navigate to the OAuth URL we provided above, and store the workspace specific token in our database.

Once OAuth has successfully completed, you're ready to start using Votey!

Development

Installation

Votey runs on Python 3.8, so you'll need to make sure your environment has Python 3.8 and Pipenv installed.

Run the following in the source directory:

pipenv install -d
pipenv run install-hooks
cp .env.example .env

Modify your .env file to look something like this:

SQLALCHEMY_DATABASE_URI='postgres://some_postgres_connection_string'
CLIENT_ID='slack_client_id'
CLIENT_SECRET='slack_client_secret'
SIGNING_SECRET='slack_signing_secret'
FLASK_ENV='development'

Go ahead and fill the above with your actual Slack API information (refer to the Deploying for Production section above), and your postgres database URI. If you don't have a postgres database running, you can either set one up locally or use the Deploy with Heroku button above to have a database provisioned for free. To boot the app, run pipenv run start.

Connecting your app to Slack follows the same procedure as the Deploying for Production section above, but instead of using Heroku's domain, you'll need to use a tunneling forwarding program like ngrok.io.

While developing, you can use pipenv run <format|lint|pre-commit> to format code, run linters, or run the whole pre-commit suite over all files (which will both format and lint).

Before committing, don't forget to run pipenv run install-hooks.

Happy Developing!

mtbpoll's People

Contributors

kedarv avatar matthewess avatar sanaerosen-yelp avatar dependabot[bot] 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.