Last active
July 9, 2017 18:57
-
-
Save dwardu89/672a9b160f5ec047bed78b010ce79cdc to your computer and use it in GitHub Desktop.
A skeleton for an AWS lambda function that will ultimately be used to output an Alexa skill.
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
''' | |
A skeleton for an AWS lambda function that will ultimately be used to output an | |
Alexa skill. | |
''' | |
def lambda_handler(event, context): | |
''' | |
Do work over here | |
''' | |
title = '' | |
output = '' | |
card_text = '' | |
reprompt_text = '' | |
should_end_session = False | |
return build_speechlet_response(title, output, card_text, reprompt_text, | |
should_end_session) | |
def build_speechlet_response(title, output, card_text, reprompt_text, | |
should_end_session): | |
return { | |
'outputSpeech': { | |
'type': 'PlainText', | |
'text': 'Trump Said: ' + output | |
}, | |
'card': { | |
'type': 'Simple', | |
'title': title, | |
'content': card_text | |
}, | |
'reprompt': { | |
'outputSpeech': { | |
'type': 'PlainText', | |
'text': reprompt_text | |
} | |
}, | |
'shouldEndSession': should_end_session | |
} | |
def build_response(session_attributes, speechlet_response): | |
return { | |
'version': '1.0', | |
'sessionAttributes': session_attributes, | |
'response': speechlet_response | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment