Skip to Main Content
Alexa Skills Projects
book

Alexa Skills Projects

by Madhur Bhargava
June 2018
Beginner to intermediate content levelBeginner to intermediate
250 pages
4h 41m
English
Packt Publishing
Content preview from Alexa Skills Projects

Coding the Lambda function

We will be editing the code inline, in the index.js file on the developer portal itself:

  1. Implement the handling of events in exports.handler. Our Lambda will be handling two basic requests:
    • LaunchRequest: To handle the launch of the skill
    • IntentRequest: To handle various intents (in our case we have just two intents, the first one being the fetchPrice intent, which asks the Lambda to fetch the price of a specific cryptocurrency, and AMAZON.StopIntent, which indicates an exit from the skill)

We'll start by segregating each of the requests that our skill receives. For this, declare the following handler:

exports.handler = function (event, context) {    try {        if (event.request.type === "LaunchRequest") {            
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-on Building Alexa Skills

Hands-on Building Alexa Skills

Paul Hickey

Publisher Resources

ISBN: 9781788997256Supplemental Content