slack-pokerbot icon indicating copy to clipboard operation
slack-pokerbot copied to clipboard

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

Open geraldeersteling opened this issue 7 years ago • 4 comments

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...

geraldeersteling avatar Jun 21 '17 15:06 geraldeersteling

Ok I managed to get somewhat further on my own by looking at #1 (might put that in the readme?); I now have a response back from Slack. But is there a typo in your app.py?

It fails on trying to find the global name SLACK_TOKEN, which you use in line 49 in your python script. Shouldn't this be SLACK_TOKENS?

geraldeersteling avatar Jun 22 '17 08:06 geraldeersteling

Hello @geraldeersteling,

Line 49 was definitely a typo. I have fixed it with commit https://github.com/nateyolles/slack-pokerbot/commit/5b2e0e8643b6c3eac50a4b4386bfedecca5c4462.

It's been a while since I last used AWS Lambda, so I don't have the answer immediately off the top of my head. As you figure this out, please create a PR with improvements to the instructions in the README.

Thank You!

nateyolles avatar Jun 23 '17 04:06 nateyolles

Hi @nateyolles,

Thanks for fixing, I've managed to get everything to work! I created a PR for the readme.

There is one more thing I'd like to ask, maybe you know what's up...even though you said it's been a while since you used Lambda. 😄

I've tried adding actions to the message which is send back to Slack (explained here), but I'm having trouble with the payload that comes back from Slack. I found someone saying the same stuff, but sadly his gist doesn't work. Maybe you know what's going wrong there.

geraldeersteling avatar Jun 23 '17 05:06 geraldeersteling

actions look like they would be a great update to this project. They weren't a part of Slack's API when I originally wrote this.

nateyolles avatar Jun 23 '17 06:06 nateyolles