Skip to content

Instantly share code, notes, and snippets.

@taniacomputer
Last active November 27, 2019 04:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taniacomputer/4f578feb65b1928958d6598c10a1eac9 to your computer and use it in GitHub Desktop.
Save taniacomputer/4f578feb65b1928958d6598c10a1eac9 to your computer and use it in GitHub Desktop.
import json
from urllib import parse as urlparse
import urllib.parse
def lambda_handler(event, context):
request_body = event["body"]
decodedBody = event["body"].replace('payload=','', 1)
decodedBody = urllib.parse.unquote(decodedBody)
decodedBody = json.loads(decodedBody.replace("\\",""))
returned_text = "*Request received from Slack button click:*\n" + str(event) + "\n\n*Request body _before_ decoding:*\n" + request_body + "\n\n*Request body _after_ decoding:*\n" + str(decodedBody)
return {
'statusCode': 200,
'body': returned_text
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment