Doing your alexa skill setup right can not only save you a ton of time but also makes you more flexible and less error prone. In this article we will setup a new skill completely based on code, so that you will have everything — from the developer console to the lambda function — in your local repo.
The example skill we will setup will be a trivial “Hello World” skill, as this article only cares about the setup and not the skill itself. The article will also assume that you have understood the essential parts of what you need to make a skill run.
Check out the repo with the finished project on Github
The developer console is used to manage all the skills information like the invocation name, intents to the skills store description. However, managing all that information in the developer console has a few disadvantages:
To tackle these problems we will use the ask cli. The ask cli offers us to store all information in json files and deploy it via commands. Therefore, we have everything (code and skill information) in one place and versioned. So let’s setup the project:
There are now 3 files where the skills information and configuration is saved:
As we use the serverless framework for the code deployment we will have to change the configuration a little bit and reorder some files to make it more convenient to work with:
We can now execute ask deploy to push the model and skill information to the developer dashboard.
The current ask cli doesn’t support updating the models json when you changed it with the skill builder. It can only clone the complete project and overriding the current one. A workaround after doing some stuff with the skill builder would be to clone the project into a new folder and then copy&paste the models json into the current project.
To define and deploy our skill function and infrastructure we will use the serverless framework. Serverless is the market leader in deploying and operating serverless architectures. The direct advantage to the ask cli is that we can not only deploy our code but also define the AWS infrastructure. This allows as for example to add a database, s3 or other stuff we might use in our skill later on. So let’s start deploying our function:
<a href="https://medium.com/media/827acc3a6a9b343c83114644b46375cf/href">https://medium.com/media/827acc3a6a9b343c83114644b46375cf/href</a>
3. Deploy the function with serverless deploy
4. When the deployment is finished you can display the ARN (unique skill qualifier on aws) with serverless info --verbose. Copy the ARN and replace the arn:CHANGE_LATER value in your .ask/config file with it. This will link the skill configuration on the developer dashboard with your lambda function
5. Update the skill configuration with ask deploy
The skill setup is now finished. You can now go to the skill store and activate your own skill.
With this setup we are now able to change the skill configuration, lambda function and deploy the updates with one command each. Also everything is versioned and in one project folder.
Additionally, we can do some polishment and save the ask cli and serverless package as dev dependency into our package.json. Thereby all tools come with the project. We also put all commands we use in there. In this way we just have to remember a few easy commands. If you want to see everything in detail, checkout the repository:
feedm3/learning-alexa-skills-basic-setup
Happy skill development :)