In this video, Lee reviews the Node.js SDK for Alexa and shows how to create the Node.js project for the skill. The Node.js dependencies are installed and the initial index.js starter file is set up. At the end of this video, the project structure and setup will be completed so that development can begin.
- [Instructor] Now it's time to setup the project for our Alexa Skill Handler. To help with that, we'll be using the Alexa Skills Kit for Node.js that is provided by Amazon. Here is the GitHub link to the SDK, where you can find a lot of information and documentation about the SDK itself, and how to use it. Let's first create the project folder. Here in my Downloads folder I'm going to create a new folder, and I'm going to call this MyCalculator.
So once that's created, I'm going to open up a terminal, or if you're on Windows you can open up a command prompt, and I'm going to navigate to my project folder. Let's initialize our project using npm, our node package manager, and this would have been installed when we did our Node.js installation. So we're going to type in here npm init, to initialize our project. We can leave the package name as default, mycalculator.
Hit enter for the version. For the description you can type in here, My Alexa Calculator Skill. Index.js will be our entry point. We can hit enter for a test command and git repository. For keywords, we can put in here, calculator, and alexa. Again, you can use any keywords that you want.
The author, you can put your name in here. Leave the default license. And then it asks for a confirmation, and just hit enter to confirm. So once that's done, if you'll notice, a package.json file will be created for you. And this has all the information about your project, and its dependencies. When we look at the Alexa Skills Kit, there are several different packages that are available.
We will be using the core library, and the model library, which is a dependency of the core library, in order to make our project lean. Heading back over to the terminal, we're going to install, first, the core library. So we're going to run npm install --save ask-sdk-core. And once that's completed, let's go ahead and install the model library.
So that's npm install --save ask-sdk-model. And at this point, if we look at our project, we would see the package.json file, the package-lock.json file, and as well as the node_modules. So the node_modules folder contains all of our dependencies, and as you'll see in there would be install the sdk-model, and as well as the core component of the SDK.
The last bit of setup we need to do is to create our index.js file. If you download the exercise files for the course, and you navigate to the 06_01 folder, in there there's an index.js file. You can copy that file. And we're going to paste that into our project. So now, switching back over to the terminal, if you look at your folder structure, and you look at the files that are in the folder, you should see that index.js file showing up.
The last bit of setup we need to do is to create our project in our IDE. So I'm going to go ahead and open up Atom. And I'm going to add a project folder. And now, here is our completed project. So, once these steps have been completed our project dependencies would have been installed, and we would be at the point where we can start coding our skill handler.
- Reviewing Alexa basics
- Setting up your accounts and environment
- Identifying Alexa skills
- Building a custom Alexa skill
- Configuring skill functionality
- Testing skills
- Expanding skills
- Submitting a custom Alexa skill for certification