Created
May 23, 2020 18:48
-
-
Save epmallmann/1065d49e06442ac0657c3cb5f12627ce to your computer and use it in GitHub Desktop.
digaOiLambda-languages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import urllib.parse | |
def lambda_handler(event, context): | |
body = event['body'] | |
print(body) | |
qs = urllib.parse.parse_qs(body) | |
print(qs) | |
language = '' | |
if ('text' in qs and len(qs['text']) > 0): | |
language = qs['text'][0] | |
language = language.lower() | |
response_text = 'Oi!' | |
if (language == 'ingles' or language == 'inglês'): | |
response_text = 'Hi!' | |
elif (language == 'espanhol'): | |
response_text = 'Hola!' | |
response = { | |
"response_type": "in_channel", | |
"text": response_text | |
} | |
return { | |
'statusCode': 200, | |
'body': json.dumps(response) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment