Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 22 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save willdages/dcac226b8d482b9dc105e6044a677345 to your computer and use it in GitHub Desktop.
Save willdages/dcac226b8d482b9dc105e6044a677345 to your computer and use it in GitHub Desktop.
Slack's Interactive Messages endpoint reports a Content-Type of `application/x-www-form-urlencoded` but responds with something like looks like `payload=%7B%22actions%22%3A%5B%7B%22...`, which is encoded JSON inside the payload parameter, which takes the API Gateway VTL templates for a loop.
## The `substring(8)` returns the input with everything after "payload=" which is the only parameter passed in,
## everything else is encoded JSON inside that parameter.
#set ($encodedJSON = $input.body.substring(8))
$util.urlDecode(${encodedJSON})
@StJohn3D
Copy link

StJohn3D commented Jul 7, 2018

Thanks a million. I had a body mapping I got from another site that was working for slash commands but wasn't working for interactions. Slack should really just send json

@YAMABASS80
Copy link

You are my savior! Thanks!

@DanielBlei
Copy link

Saved my day. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment