Code Monkey home page Code Monkey logo

slack-pokerbot's Introduction

Slack Pokerbot for AWS Lambda

Pokerbot is a Slash Command for Slack. It's easily hosted on Amazon Web Services' Lambda.

Screenshot of Pokerbot in Slack

Configure Slack Slash Command

  1. Navigate to https://.slack.com/apps/manage/custom-integrations
  2. Click on "Slash Commands" and "Add Configuration"
  3. Set the Command to "/pokerbot"
  4. Set the URL to the path provided by AWS
  5. Set the Method to "POST"
  6. Set Custom Name to "pokerbot"
  7. Customize Icon if you wish
  8. Check "Show this command in the autocomplete list"
  9. Set Description to "Play Scrum planning poker"
  10. Set Usage Hint to "help [or deal, vote , tally, reveal]""
  11. Copy the Token

Configure

  1. Paste the Slack Token
  2. Set the path to your images
  3. Set the planning poker values you want to use (e.g. 0, 1, 2, 3, 5, 8, 13, 20, 40, 100)

AWS Lambda

  1. Create a AWS Lambda; following the instructions from Amazon

  2. Paste the app.py file into the web editor or upload as directed by AWS

  3. Afterwards adjust the Integration Mapping of your API Gateway that is triggering the Lambda function

    3.1 Add a mapping for application/x-www-form-urlencoded

    3.2 Paste the snippet below into the provided template

    {"body" : $input.json('$')}
    

โ— Do not forget to deploy your API after changing the integration mapping

Play Poker Planning

  1. Type "/pokerbot deal" in a channel
  2. Everyone votes by typing "/pokerbot vote "
  3. Type "/pokerbot tally" in the channel to show the names of those who have voted
  4. Type "/pokerbot reveal" in the channel to reveal the voting results

slack-pokerbot's People

Contributors

geraldeersteling avatar nateyolles avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

slack-pokerbot's Issues

integration mapping in API Gateway

I'm getting the follow response in Slack from the Lambda function:

PokerBot BOT [5:15 PM] Only visible to you
{"message": "Could not parse request body into json: Unrecognized token 'token': was expecting 'null', 'true', 'false' or NaN\n at [Source: [B@238685e5; line: 1, column: 7]"}

My guess is tat I have not configured the Integration Maping in the API Gateway correctly (in fact, I've left it on it's defaults).

Should I be putting a mapping template in here?

Cheers

Dan

Help getting this to work (also an AWS Noob/newbie)

Hi Nate,

This looks great and useful, but I'm struggling as how to make it work. I think I'm off to a good start though...I've:

  • Configured the Slack command
    • I pasted the AWS Lambda URL (looks like: https://{AN_ID}.execute-api.eu-west-1.amazonaws.com/prod/{my_lambda_function}) in the command
    • The method is set to POST
    • entered all the other things as well
  • Made a AWS Lambda function connected to an API gateway with resources
    • Pasted Slack's token in your python script
    • I think it works when I 'Test and Save' the function. It gives me a stacktrace from your script that the it fails on req_body = event['body'], which is obvious because I tested the script with bogus test data

After all this first I got the Missing authorization error when following the URL from AWS and consequentially an 403 when invoking /pokerbot in Slack.

I clicked around somewhat and removed the "ANY" resource in my API and added a POST resource; configuring the POST endpoint to my lambda function.
This somehow helped (I think?) but now Slack gives me a 503 whenever I invoke the command.

I'm not sure where to go from this, nor do I know if I did everything right. Could you (or someone) help me out?

Much appreciated already...

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.