Deploying the Skill

How you deploy a skill depends on whether the skill is Alexa-hosted or AWS Lambda-hosted. Since we chose Alexa-hosting, all we need to do to deploy our skill is to commit and push our skill using the git command line:

 $ ​​git​​ ​​add​​ ​​.
 $ ​​git​​ ​​commit​​ ​​-m​​ ​​"Initial customization for Star Port 75"
 $ ​​git​​ ​​push

Alexa-hosted skills are backed by AWS CodeCommit, which offers a private Git repository. When you push your Alexa-hosted skill code to CodeCommit, it will automatically be deployed for you within a few minutes of submitting the git push command.

If, however, you chose AWS Lambda-hosting for your skill, then you’ll be responsible for providing your own source code control. To deploy the skill, you can use the ask deploy command like this:

 $ ​​ask​​ ​​deploy

After hitting the enter key, the ASK CLI takes care of the rest. Among other things, it deploys the interaction model to ASK and builds it to be ready to take requests. It also deploys the fulfillment code to AWS Lambda for you, freeing you from having to work with AWS Lambda directly. It takes a few moments to complete, but once it does, your skill will be deployed and ready to use.

That said, it is only available on Alexa devices connected to your Amazon account, so don’t start calling your friends and family or blasting an email announcement to the world just yet. Deploying a skill with ask deploy only makes it available for testing with devices and tools connected to your account. In order to make your skill available for general consumption, you’ll need to publish it. We’ll see how to publish skills in Chapter 13, Publishing Your Skill.

For now, however, it’s good enough to do a few manual tests against your skill. If you own an Alexa-enabled device associated with your developer account, simply say, “Alexa, open star port seventy five.” If all goes well, she should respond with “Welcome to the Star Port 75 Travel. How can I help you?” Then, if you follow up by saying “Hello” or “Say Hello,” she will reply with “Have a stellar day!”

While trying out a custom skill on a real Alexa device is very satisfying, you don’t need an Alexa device to try out your skill. Another option you’ll find useful is to sign into the ASK developer console,[10] find your skill in the list of available skills, then click on the “Test” tab to use the Alexa Simulator. The following screenshot shows a brief test session in the simulator:

images/hello/simulator-hello.png

In the left-hand panel, you can either type what you want to say to Alexa, or click and hold the microphone icon and speak what you want to say. Your conversation will appear in the speech bubbles below the text box. In this screenshot, we’ve asked her to open the skill we’ve created in this chapter and then said “Hello” to her.

In the panel on the right, you’ll be shown JSON for the most recent request and response. This is useful for debugging more complex skills. But for our simple skill, it’s just interesting information. We’ll take a deeper look at this JSON later in the book, as we need it to understand how our skills work.

Another way to try out your Alexa skill is with Visual Studio Code.[11] Aside from being a fantastic editor for developing your Alexa skills, Visual Studio Code with the Alexa Skills Toolkit extension[12] offers a great way to test your skill that’s similar to the “Test” tab in the developer console. If the ASK extension is installed, you’ll be able to click on the Alexa logo on the activity bar and then select “Test skill > Open simulator” in the left-hand menu to see an in-editor Alexa simulator. This screenshot shows what working with the simulator in Visual Studio code looks like:

images/hello/vscode-simulator-hello.png

Notice that the simulator in Visual Studio Code offers the option of exporting a session via the “Export” button (near the top). This will save the user’s utterances in a JSON file. Then later you can replay it by selecting “Test skill > Replay session” from the left-hand menu.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset