Explaining the Lambda project (Java)

We used ASK SDK v2 (Java) in this recipe. With this SDK version, you need to define handlers for each of your intents. Each handler has a canHandle function and a handle function. The canHandle function checks and confirms what intents the handler responds to and the handle function contains the actual logic for the intent.

Apart from the intent handler classes, you also need to define a parent handler class that extends the SkillStreamHandler class. From this handler class, you need to pass an AlexaSkill object that contains all the other intent handlers into the SkillStreamHandler parent constructor through a super call. 

If you are using the older version of the SDK, you can go to https://alexa-skills-kit-sdk-for-java.readthedocs.io/en/latest/Migrating-To-ASK-SDK-v2-For-Java.html to migrate to the version (v2) that we use in this recipe. 

In the introduction, I wrote CloudMaterials.com and javajee.com differently so that Alexa says them in the way that I want. You can use speech synthesis markup language (SSML) for better control over how Alexa generates speech. 

We first gave permission for any Alexa skill to invoke our lambda. This is because you can create a skill with a lambda endpoint only if the lambda has an Alexa trigger. Once you create a skill, you can remove this permission and add a permission that only allows this skill to invoke this lambda. The alternative is to create the skill without an endpoint, as shown in the following code, located in the skill.json file:

"apis": {
"custom": {
}
},

You can then create the lambda and add a trigger with this skill's ID. After that, you can update the skill.json with the endpoint and use the update-skill subcommand to update the skill, as shown in the following code:

ask api update-skill 
--skill-id amzn1.ask.skill.6fed53f3-661e-4f26-8de8-4ee4844f899b
--file skill-update.json

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.91.254