To handle the intents inside our new Alexa Skill, we need to create a Lambda function. This will contain all of the logic we need to understand the intent and send a reply to the user.
To create a Lambda, we can use any of the methods described in Chapter 2, Getting Started with AWS and Amazon CLI, but we're going to be using our local development setup. Navigate to your base Lambda folder and create a new folder called hello-alexa-skill. Inside that folder, we need to create a new index.js file and open it to create our function.
To start, we need to require in the alexa-sdk, which makes creating the logic for Alexa a lot easier:
const Alexa = require('alexa-sdk');
Because we are requiring it, we also need to make sure that we have it installed. In the command-line interface, navigate into your hello-alexa-skill folder and...