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") {            

Get Alexa Skills Projects now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.