Install the ask command-line interface for Alexa on macOS

You’ve written an Alexa skill. Now you want to upload it to Alexa and submit for certification. Before you do anything, you’ll want to make sure you have a developer account setup and that you’ve accepted the EULA for the Alexa developer program at https://developer.amazon.com/alexa. To do so, simply go there and click sign in and it’ll take you through the prompts. You’ll need this as when you init your session, you’ll be prompted to link an account through the Amazon website.

Once done, let’s get the technical stuff out of the way. First, install the latest version of node from https://nodejs.org/dist/v6.10.0/node-v6.10.0.pkg (it’s a package so follow the defaults to install the package). Once that’s done, verify that the version of node.js is modern using the –version option with the node command:

node --version

Then install ask via npm:

sudo npm install -g ask-cli

Once that’s done, we’ll need to link accounts. To start that process, run the ask command along with the init verb:

ask init

This will open a webpage to link your account. Accept that by clicking the Continue button.

The skills you’re creating will be stored in lambda functions usually. So let’s create a skill using the new verb:

ask new --skill-name krypted

This should respond as follows:

New project for Alexa skill created.

Next, let’s deploy that. To do so, take the .json file that is the skill you’re uploading and make sure it’s in the working directory of the computer you’re on. Then, use ask along with the deploy verb, which automatically looks for a file called skill.json in your working directory and uploads it. 

ask deploy

Once uploaded, go ahead and verify it’s there:

ask api list-skills

If it’s there, you might as well try it out. You’ll need the skill-id for this (e.g. amzn1.ask.skill.2468-2468-2468-246824682468)  To do so, let’s use the simulate verb, running in debug mode, with some text input.

ask simulate --sl --skill-id amzn1.ask.skill.2468-2468-2468-246824682468 --text "read latest article" --debug

If your new skill works, then you can submit it for skill certification (which I’ll do in debug mode here):

ask api submit -s|--skill-id amzn1.ask.skill.2468-2468-2468-246824682468 --debug

Or if you’d rather remove the skill, simply swap out submit with withdraw

ask api withdraw -s|--skill-id amzn1.ask.skill.2468-2468-2468-246824682468 --debug