Last active
September 20, 2017 10:21
-
-
Save jagrament/3e00d41097182ef250fc9a10012f79ae to your computer and use it in GitHub Desktop.
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 boto3 | |
import json | |
print('Loading function') | |
def respond(err, res=None): | |
return { | |
"headers":{"Content-Type": "application/json"}, | |
'statusCode': 200, | |
'body' : json.dumps(res) | |
} | |
def lambda_handler(event, context): | |
payload = json.loads(event['body']) | |
if payload['args']['intent'] == 'weather': | |
response_body = {"error_code": "success", "status": "true", "user_id": payload["user_id"], "params": {"status": "200", "message": payload["args"]["location"] + "の天気は晴れです。"}, "bot_id": payload["bot_id"]} | |
return respond(None, response_body) | |
else: | |
return respond(None, {"error_code": "success", "status": "true", "user_id": payload["user_id"], "bot_id": payload["bot_id"], "params": {"status": "true", "message": "そのIntentには対応していません。"}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment