-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Slack Command Example Doesn't Work #74
Comments
Thanks for the feedback @jaypeng2015 - things have changed quite a bit since the time I initially worked on that example. Fixes in progress. tyvm. |
Hi @jaypeng2015 - I've updated the demo together with the upcoming 0.20.2 release. With the changes things appear to be back functioning. |
Thanks @mweagle , I will test this again after the release. |
Hi @jaypeng2015 - I've released 0.20.2 & updated the sample at https://github.com/mweagle/SpartaSlackbot/blob/master/slack.go. Please LMK if this resolves the issue. Thanks! |
Tested on 0.20.3 and it went well. |
Version: 0.20.1
I am trying to create a slack command by following: http://gosparta.io/docs/apigateway/example3/, but there are some things break:
Should return on error
There a several
if err != nil {...}
which send 500 error to the client. However the function doesn't stop after doing that but still executes the rest lines.Missing Content Type
The last step of this function
Send the content as text. Requires
w.Header().Set("Content-Type", "application/json")
to make it work.Custom Event Type
The whole part doesn't work for me. What I received from API Gateway is already JSON, not a form string, so I created a new struct:
And then changed body to
Body slashCommandJSONBody
json:"body"`` to make it work.Integration mapping breaks on empty fields
If the command has no
text
, e.g./weather
, the original body will be something like "user_id=U12345&text=&command=/weather", then the api gateway will just return 500 error.From the source code I found this
## Ref: https://gist.github.com/ryanray/668022ad2432e38493df
, and from that link I can see someone else was having the same issue. As long as I put text in, everything work fine.The text was updated successfully, but these errors were encountered: