User Tools

Site Tools


echo_hello_world

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
echo_hello_world [2016/12/30 11:35] tbrodeurecho_hello_world [2016/12/31 14:13] (current) tbrodeur
Line 4: Line 4:
 </color> </color>
  
-1. <fs large>Create a Lambda Function</fs>+ 
 +<fs small> 
 +**Author:** Tristan Brodeur  
 + 
 +**Email:** brodeurtristan@gmail.com 
 + 
 +**Date:** Last modified on 12/29/16  
 + 
 +**Keywords:** Alexa, Amazon Skills Kit</fs>
  
 <color #22b14c>----------------------------------------------------------------------------------------------------------------------------- <color #22b14c>-----------------------------------------------------------------------------------------------------------------------------
 </color> </color>
  
-To create a lambda function, follow this tutorial: [[using_lambda|Creating a lambda function]]+<fs large>Overview</fs>
  
-2. <fs large>Add the code</fs>+{{ youtube>m8i3vgwMH3k?medium }} 
  
 <color #22b14c>----------------------------------------------------------------------------------------------------------------------------- <color #22b14c>-----------------------------------------------------------------------------------------------------------------------------
 </color> </color>
 +
 +1. <fs large>Create a Lambda Function</fs>
 +
 +To create a lambda function, follow this tutorial: [[using_lambda|Creating a lambda function]]
 +
 +<color #22b14c>-----------------------------------------------------------------------------------------------------------------------------
 +</color>
 +
 +2. <fs large>Add the code</fs>
  
  
Line 62: Line 79:
  speech_output = "Hello World"  speech_output = "Hello World"
  reprompt_text = ""  reprompt_text = ""
- should_end_session = False+ should_end_session = True
  
  return build_response(session_attributes, build_speechlet_response(  return build_response(session_attributes, build_speechlet_response(
Line 96: Line 113:
 ####################################################################  ####################################################################
 </code> </code>
 +
 +<fc #4682b4>
 +******Make sure to change the application id listed in lambda_handler() to your own id once you create the Alexa Skill with Alexa Skills Kit******</fc>
  
 <color #22b14c>----------------------------------------------------------------------------------------------------------------------------- <color #22b14c>-----------------------------------------------------------------------------------------------------------------------------
Line 182: Line 202:
 </color> </color>
  
 +Looking at the say_hello function, 
 +
 +<code python>
 +def say_hello():
 + session_attributes = {}
 + card_title = "Hello World"
 + speech_output = "Hello World"
 + reprompt_text = ""
 + should_end_session = True
 +
 + return build_response(session_attributes, build_speechlet_response(
 +        card_title, speech_output, reprompt_text, should_end_session))
 +</code>
 +
 +we can see that the function returns a build_response function that will pass arguments defined in the say_hello function.
 +
 +-card_title: name of the card that will display on the Alexa app on your smartphone
 +
 +-speech_output: what the Echo or Echo Dot will ouput once the function build_response function is called
 +
 +-should_end_session: tells Alexa whether to end the skill session after a response has been outputed. This should be set to True in this case. If a reprompt text is defined, usually should_end_session would be set to false, however all we are doing with this function is asking for a simple output.
 +
 +<color #22b14c>-----------------------------------------------------------------------------------------------------------------------------
 +</color>
  
 After the code is added, [[using_alexa_skills_kit|configure your lambda function with the Alexa Skills Kit.]] After the code is added, [[using_alexa_skills_kit|configure your lambda function with the Alexa Skills Kit.]]
echo_hello_world.1483126551.txt.gz · Last modified: by tbrodeur