Skip to content

Instantly share code, notes, and snippets.

@dwardu89
Last active July 9, 2017 18:57
Show Gist options
  • Save dwardu89/672a9b160f5ec047bed78b010ce79cdc to your computer and use it in GitHub Desktop.
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.
'''
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