<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ amazon echo - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ amazon echo - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Fri, 12 Jun 2026 05:20:49 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/tag/amazon-echo/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ How Echo Buttons take Amazon Alexa Skills to a new level ]]>
                </title>
                <description>
                    <![CDATA[ By Terren Peterson I’m recognized as an Amazon Alexa Champion and have published more than twenty custom skills on the platform. I continue to look for new ways to stretch this technology, create more robust skills, and share with the community. Last... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-echo-buttons-take-amazon-alexa-skills-to-a-new-level-d4c489853b1f/</link>
                <guid isPermaLink="false">66c34d17465d1b2f886ba3e1</guid>
                
                    <category>
                        <![CDATA[ amazon echo ]]>
                    </category>
                
                    <category>
                        <![CDATA[ baseball ]]>
                    </category>
                
                    <category>
                        <![CDATA[ iot ]]>
                    </category>
                
                    <category>
                        <![CDATA[ General Programming ]]>
                    </category>
                
                    <category>
                        <![CDATA[ technology ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Thu, 26 Jul 2018 23:49:51 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*F6CHpSv0t3e2ntNu0iDygw.jpeg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Terren Peterson</p>
<p>I’m recognized as an Amazon <a target="_blank" href="https://developer.amazon.com/alexa/champions/terren-peterson">Alexa Champion</a> and have published more than twenty custom skills on the platform. I continue to look for new ways to stretch this technology, create more robust skills, and share with the community.</p>
<p>Last <a target="_blank" href="https://developer.amazon.com/blogs/alexa/post/402fd908-f8d7-4a2b-ab5e-4099222ad974/introducing-alexa-gadgets-new-tools-for-developers-to-create-fun-sign-up-to-stay-tuned">September</a>, Amazon released a new product for Alexa called Echo Buttons. These hardware devices expand the capabilities for the millions of customers that already have an Alexa. They’re relatively inexpensive, right now going for <a target="_blank" href="https://www.amazon.com/dp/B072C4KCQH/">$20/2 pack</a>.</p>
<p>In <a target="_blank" href="https://developer.amazon.com/blogs/alexa/post/705a0ac1-940d-4128-b35e-7085274eca6a/gadgets-skill-api-beta-is-now-available-developers-can-build-games-for-echo-buttons">April</a> of this year, Amazon opened up the platform for developers like me to begin incorporating them into custom skills. This is my experience so far programming with them.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/CyYLDlEogrNXnrYiXgOAfMnPLr-EHMGF5S87" alt="Image" width="800" height="600" loading="lazy">
<em>Echo Button in inactive state.</em></p>
<h3 id="heading-getting-started-with-echo-buttons">Getting Started with Echo Buttons</h3>
<p><img src="https://cdn-media-1.freecodecamp.org/images/rD-kqpmupIZML-HuI46qqn97rNmfe2CmT7fx" alt="Image" width="700" height="300" loading="lazy">
<em>Network connectivity of Echo Buttons</em></p>
<p>Buttons are paired with Alexa devices through a bluetooth connection, becoming a physical extension of the speaker. All network traffic from the button to use Amazon services goes through the paired device. Don’t buy buttons if you don’t already have an Alexa, as they don’t do anything on their own.</p>
<p>If you have multiple speakers associated with your account, the button will only work with the device it’s currently paired with. The pairing can be undone with just a few steps on your phone. To unpair a device, just use the Alexa companion app and go into the settings section. Select the button that has already been paired, and it will release it. Then go back through the steps to repair to another device.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/hivuzrSwuf4WcMXDB25tWOKDBXz6qIeQHMiy" alt="Image" width="750" height="1073" loading="lazy">
<em>Screenshot of Alexa App on a Mobile Device</em></p>
<p>This makes buttons an easy add on for Alexa enthusiasts, and makes them flexible for those with multiple devices.</p>
<h3 id="heading-how-buttons-interact-with-custom-skills">How Buttons Interact with Custom Skills</h3>
<p>Alexa is an event driven architecture. Events are created by the sounds going into the speaker that are translated through Cloud based service. Normally these events are initiated after the array of microphones picks up a command from a user. These commands are then translated by the ASR (Automated Speech Recognition) models depending on which custom skill is being used.</p>
<p>With buttons, a new type of event is created that follows a similar pattern. When the button is pressed, an event is created and sent to the skill that runs in the Cloud. When the button is released, a separate event is created. These events are created independently of anything being picked up by the microphones on the Echo Speaker and flow through a Cloud based service called the Game Engine.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/xn54u0QFvTYWHG-5EBh2IwBAYKiYXRMUVCAY" alt="Image" width="650" height="334" loading="lazy">
<em>Alexa Event Architecture including Buttons</em></p>
<p>The Lambda function that contains the logic for the custom skill needs to process these events along with the existing voice triggered ones. Translating request objects is facilitated by the Alexa SDK installed in the Lambda function. Examples of how this works are provided in the <a target="_blank" href="https://github.com/alexa/skill-sample-nodejs-buttons-hellobuttons">Alexa repo</a>.</p>
<p>This opens up new possibilities for gameplay, as a user can leverage both their voice and hands to interact with the skill. Engaging more senses broadens the experience, and enables more complex gaming. For example, in the <a target="_blank" href="https://www.amazon.com/Seventh-Inning-Stretch-Baseball-Game/dp/B071FF8WCN">Seventh Inning Stretch skill</a>, a user can play a baseball game listening on their speaker while pressing the button to swing the bat.</p>
<h3 id="heading-how-skills-use-the-gadgets-api">How Skills use the Gadgets API</h3>
<p>Using buttons within a custom skill requires the Gadgets API. Documentation is currently on this <a target="_blank" href="https://developer.amazon.com/docs/gadget-skills/understand-gadgets-skill-api.html">website</a>, and note that it is still in beta. Buttons are just a type of gadget, and provide a glimpse into what’s possible with enabled hardware.</p>
<p>Connectivity between systems is facilitated by interfaces across the internet. The API that buttons need is invoked by adding directive attributes to a standard Alexa response object. This enables the SDK to handle the explicit details for the HTTPS call (i.e. encoding the header, setting the attributes, error handling, etc.)</p>
<p>Here is an example of adding a directive to set the lights on a button at the same time that the Echo speaker reads back an introduction to the user.</p>
<pre><code><span class="hljs-string">"response"</span>: {               <span class="hljs-string">"shouldEndSession"</span>: <span class="hljs-literal">false</span>,               <span class="hljs-string">"outputSpeech"</span>: {                     <span class="hljs-string">"type"</span>: <span class="hljs-string">"SSML"</span>,                     <span class="hljs-string">"ssml"</span>: <span class="hljs-string">"&lt;speak&gt; Welcome back to Seventh Inning Stretch.&lt;break time=\"1s\"/&gt;We found an prior game in progress. Would you like to resume? &lt;/speak&gt;"</span>                 },               <span class="hljs-string">"reprompt"</span>: {                     <span class="hljs-string">"outputSpeech"</span>: {                           <span class="hljs-string">"type"</span>: <span class="hljs-string">"SSML"</span>,                           <span class="hljs-string">"ssml"</span>: <span class="hljs-string">"&lt;speak&gt; Say yes to resume the in-progress game, or no to delete it.  &lt;/speak&gt;"</span>                     }               },               <span class="hljs-string">"directives"</span>: [    {                           <span class="hljs-string">"type"</span>: <span class="hljs-string">"GadgetController.SetLight"</span>,                            <span class="hljs-string">"version"</span>: <span class="hljs-number">1</span>,                           <span class="hljs-string">"targetGadgets"</span>: [],                           <span class="hljs-string">"parameters"</span>: {                      <span class="hljs-string">"animations"</span>: [               {                         <span class="hljs-string">"repeat"</span>: <span class="hljs-number">1</span>,                            <span class="hljs-string">"targetLights"</span>: [<span class="hljs-string">"1"</span>],              <span class="hljs-string">"sequence"</span>: [                          {                    <span class="hljs-string">"durationMs"</span>: <span class="hljs-number">30000</span>,                                                               <span class="hljs-string">"color"</span>: <span class="hljs-string">"FFFF00"</span>,                  <span class="hljs-string">"blend"</span>: <span class="hljs-literal">false</span>                                                     }              ]                      }           ],      <span class="hljs-string">"triggerEvent"</span>: <span class="hljs-string">"buttonDown"</span>,                                <span class="hljs-string">"triggerEventTimeMs"</span>: <span class="hljs-number">0</span>    }}
</code></pre><p>The Game Engine creates events just like the Echo speaker. The same taxonomy is used, and the attributes within the request identifies event details. Below is an example of a request indicating that a button was pressed.</p>
<pre><code>“request”: {   “type”: “GameEngine.InputHandlerEvent”,   “requestId”: “amzn1.echo-api.request.xxx”,   “timestamp”: “<span class="hljs-number">2018</span>–<span class="hljs-number">07</span>–<span class="hljs-number">21</span>T21:<span class="hljs-number">33</span>:<span class="hljs-number">25</span>Z”,   “locale”: “en-US”,   “originatingRequestId”: “amzn1.echo-api.request.xxx”,   “events”: [     {       “name”: “button_down_event”,       “inputEvents”: [ {         “gadgetId”: “amzn1.ask.gadget.xxxx”,         “timestamp”: “<span class="hljs-number">2018</span>–<span class="hljs-number">07</span>–<span class="hljs-number">21</span>T21:<span class="hljs-number">33</span>:<span class="hljs-number">25.374</span>Z”,         “color”: “<span class="hljs-number">000</span>DD6”,         “feature”: “press”,         “action”: “down”       } ]     }   ] }
</code></pre><h3 id="heading-save-battery-life-through-roll-call">Save Battery Life through Roll Call</h3>
<p>Echo Buttons are battery powered, making energy management important. When a custom skill requires a button, it must initiate a connection and wake the button. This is done through a process called ‘roll call’ within the custom skill.</p>
<p>To initiate a roll call in a custom skill, add a directive to the response object providing the parameters to perform the task. In parallel, audio instructions need to be included in the response object. These will encourage a user to do something with the buttons. For example, ask the user to press each button to get started.</p>
<p>For specifics on what a directive looks like, here is the roll call directive I use for my Seventh Inning Stretch skill. It’s a series of attributes in a large JSON object. This sets the timeout parameter for when the buttons can go back to sleep if not used (the 300,000 value is in milliseconds — this translates to five minutes), and looks for just the button down event.</p>
<pre><code><span class="hljs-string">"directives"</span>: [  {     “type”: “GameEngine.StartInputHandler”,     “timeout”: <span class="hljs-number">300000</span>,     “recognizers”: {       “button_down_recognizer”: {         “type”: “match”,         “fuzzy”: <span class="hljs-literal">false</span>,         “anchor”: “end”,         “pattern”: [{ “action”: “down” }]       }    },     “events”: {       “button_down_event”: {         “meets”: [“button_down_recognizer”],         “reports”: “matches”,         “shouldEndInputHandler”: <span class="hljs-literal">false</span>       },       “timeout”: {         “meets”: [“timed out”],         “reports”: “history”,         “shouldEndInputHandler”: <span class="hljs-literal">true</span>       }     }  }]
</code></pre><p>The buttons handle the timer for when to turn off. This minimizes the risk of battery drain when a user ends their session. Skills that use buttons should also make a request to the shut off the device if the skill is exited.</p>
<h3 id="heading-translating-game-engine-events">Translating Game Engine Events</h3>
<p>The Game Engine can create events just like the speaker after it is awake. The request uses the same taxonomy, and the attributes identify details of the event. Here is an example of a request indicating that a button was pressed.</p>
<pre><code>“request”: {   “type”: “GameEngine.InputHandlerEvent”,   “requestId”: “amzn1.echo-api.request.xxx”,   “timestamp”: “<span class="hljs-number">2018</span>–<span class="hljs-number">07</span>–<span class="hljs-number">21</span>T21:<span class="hljs-number">33</span>:<span class="hljs-number">25</span>Z”,   “locale”: “en-US”,   “originatingRequestId”: “amzn1.echo-api.request.xxx”,   “events”: [     {       “name”: “button_down_event”,       “inputEvents”: [ {         “gadgetId”: “amzn1.ask.gadget.xxxx”,         “timestamp”: “<span class="hljs-number">2018</span>–<span class="hljs-number">07</span>–<span class="hljs-number">21</span>T21:<span class="hljs-number">33</span>:<span class="hljs-number">25.374</span>Z”,         “color”: “<span class="hljs-number">000</span>DD6”,         “feature”: “press”,         “action”: “down”       } ]     }   ] }
</code></pre><p>The logic within the Lambda function for the skill will need to respond to these events, and process functionality accordingly.</p>
<h3 id="heading-buttons-can-change-color">Buttons Can Change Color</h3>
<p>Inside the buttons are a series of LED’s that can be turned off and on. They are bright and the color is very rich.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/9gmdYm6OjjrrCzjeM0DLTLJ-RDtTdnB3gfKd" alt="Image" width="800" height="600" loading="lazy"></p>
<p>The buttons can also change colors by altering how the different LED’s are illuminated.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/fr7rACZlz0hBY5apboKduTEjVd7cK8tlXGDz" alt="Image" width="800" height="600" loading="lazy"></p>
<p>Color changing of the buttons is also done within directives in a response object. If you start your skill using the <a target="_blank" href="https://github.com/alexa/skill-sample-nodejs-buttons-hellobuttons">repo for buttons</a>, there are helper functions that make this easy to integrate into your skill.</p>
<h3 id="heading-closing">Closing</h3>
<p>If you’re interested in trying out a game that uses them, please test out my baseball simulation game on Alexa. It’s called “Seventh Inning Stretch” and is an attempt to recreate the fun of old handheld games from the 80’s. It’s a good example of what’s possible using these new accessories.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/ACXMJEoX78nZezIBRNITH7S5eSIsL0Jka5z6" alt="Image" width="750" height="1077" loading="lazy">
<em>Example of Alexa Skill that uses Buttons</em></p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to implement an Alexa Skill with Spring Boot ]]>
                </title>
                <description>
                    <![CDATA[ By Rafael Fiol And why you would do such a thing There are two ways to implement custom skills for Alexa. The first is the most common and is the Amazon-recommended way. Use AWS Lambda, a server-less computer service. There is no shortage of article... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/implementing-an-alexa-skill-with-spring-boot-also-why-would-you-do-such-a-thing-9992c0797646/</link>
                <guid isPermaLink="false">66c357d0dae03919d93dc06f</guid>
                
                    <category>
                        <![CDATA[ amazon echo ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Java ]]>
                    </category>
                
                    <category>
                        <![CDATA[ software development ]]>
                    </category>
                
                    <category>
                        <![CDATA[ spring-boot ]]>
                    </category>
                
                    <category>
                        <![CDATA[ technology ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Tue, 03 Jul 2018 13:06:28 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*agCi2IBtbBlRZsDfy6KRxA.jpeg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Rafael Fiol</p>
<h4 id="heading-and-why-you-would-do-such-a-thing">And why you would do such a thing</h4>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*agCi2IBtbBlRZsDfy6KRxA.jpeg" alt="Image" width="800" height="392" loading="lazy"></p>
<p>There are two ways to implement custom <a target="_blank" href="https://en.wikipedia.org/wiki/Amazon_Alexa#Alexa_Skills_Kit">skills</a> for Alexa.</p>
<p>The first is the most common and is the Amazon-recommended way. Use <a target="_blank" href="https://aws.amazon.com/lambda/">AWS Lambda</a>, a server-less computer service. There is no shortage of articles and tutorials on the topic. This is not one of them.</p>
<p>The second way is far less common. This is hosting an endpoint using a HTTPS web service that you manage. It is a bit more difficult to find good examples of this approach. This article will attempt to do just that, and will use <a target="_blank" href="https://spring.io/projects/spring-boot">Spring Boot</a> as the basis for the implementation.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*CBS-TT_JYEOWhYsdyr0OWQ.jpeg" alt="Image" width="800" height="472" loading="lazy">
<em>Endpoint configuration in the Alexa Skills Developer Console</em></p>
<p>But before we jump into the <strong>how</strong>, let’s talk about the <strong>why</strong>:</p>
<ul>
<li>Why would you not use AWS Lambda?</li>
<li>Why ignore an Amazon recommendation?</li>
</ul>
<p>These questions are important. You’ll find reams of great examples and documentation on building Skills with Lambda, and not so much for the alternative. It’s also important if you buy into the premise — which I do — that the world is going <a target="_blank" href="https://en.wikipedia.org/wiki/Serverless_computing">server-less</a>. This is a <a target="_blank" href="https://read.acloud.guru/six-months-of-serverless-lessons-learned-f6da86a73526">great article</a> on that topic by James Beswick. Going the HTTPS route will lead you down a lonely path, but sometimes that’s OK.</p>
<p>Here are some reasons why you may want or need to take that lonely path.</p>
<ul>
<li>You can write your Alexa web services using any programming language.</li>
<li>If you have existing RESTful services already deployed and you want to leverage that infrastructure/investment.</li>
<li>If your <a target="_blank" href="https://en.wikipedia.org/wiki/Chief_information_security_officer">CISO</a> does not allow off-premise or cloud-based infrastructures.</li>
<li>If you like lonely paths.</li>
</ul>
<p>In my case, I decided to explore the non-Lambda path primarily because I already had an existing services tier, which I wanted to leverage. There are <a target="_blank" href="https://en.wikipedia.org/wiki/Plain_old_Java_object">POJOs</a> and methods I wanted to reuse, without having to expose new endpoints. Of course, I could have created Lambdas that simply fronted those services, and that is a valid pattern. But I didn’t want to add another layer of deployment scripts, testing, and monitoring.</p>
<p>You probably have your own reasons. If I were building a new <a target="_blank" href="https://en.wikipedia.org/wiki/Greenfield_project">greenfield</a> application, I’d probably head down the Lambda path.</p>
<h3 id="heading-prerequisites">Prerequisites</h3>
<p>You’ll use the <a target="_blank" href="https://developer.amazon.com/alexa">Alexa Developer Console</a> to register your skill, define the intents and utterances, and test it. I’ve assumed that you’ve already created a developer account, and that you can setup a new custom Skill within the console.</p>
<h3 id="heading-a-spring-boot-alexa-skill">A Spring Boot Alexa Skill</h3>
<p>The rest of this article will show you how easy it is to add an Alexa Skill to your existing Spring Boot applications. To demonstrate this, we’ll create a skill that will lookup fun facts about either a specific year, or a random year. You’ll be able to interact with our skill by saying things such as:</p>
<pre><code>Alexa, ask my demo app to tell me trivia about a random year.Alexa, ask my demo app, what happened <span class="hljs-keyword">in</span> the year <span class="hljs-number">1984</span>?
</code></pre><p>Okay, yes, this is a pretty useless skill. But it will demonstrate all of the important aspects of an Alexa app, including:</p>
<ul>
<li>custom intent handling</li>
<li>using slots, session management</li>
<li>built-in intent handling</li>
</ul>
<p>To accomplish this, our example skill will call a free third-party API to lookup the trivia information, using the wonderful <a target="_blank" href="http://numbersapi.com/#42">NumbersAPI</a>. Many thanks to <a target="_blank" href="https://twitter.com/divad12">David</a> and <a target="_blank" href="https://github.com/mduan">Mack</a> for creating this fun service.</p>
<h3 id="heading-getting-started">Getting started</h3>
<p>First things first. Add the <a target="_blank" href="https://mvnrepository.com/artifact/com.amazon.alexa/alexa-skills-kit">Alexa Skills Kit SDK</a> to your “pom.xml” file. At the time of writing, the latest version of the SDK is 1.8.1.</p>
<pre><code>&lt;dependency&gt;    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">groupId</span>&gt;</span>com.amazon.alexa<span class="hljs-tag">&lt;/<span class="hljs-name">groupId</span>&gt;</span></span>    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>alexa-skills-kit<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span></span>    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>1.8.1<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span></span>&lt;/dependency&gt;
</code></pre><p>The SDK includes a special servlet, named <code>SpeechletServlet</code>, which you will need to load as part of the app bootstrap. This is actually very easy to do.</p>
<p>The servlet is a workhorse. It handles all of the messy <a target="_blank" href="https://developer.amazon.com/docs/custom-skills/host-a-custom-skill-as-a-web-service.html">requirements for hosting a skill</a>, such as verifying that the request was sent by Alexa, validating the signature, and checking the timestamp. Fortunately for us, we don’t have to deal with any of those headaches. We just need to load the servlet. Here’s how we do that:</p>
<p>Simple. You can see above that we’ve created a configuration class that loads our servlet. On line 10, you can see that <code>SpeechletServlet</code> is instantiated, and then on line 13 it is registered with Spring.</p>
<p>That’s pretty much all you need to do to load the servlet.</p>
<p>As I noted, the servlet takes care of all the complicated handshake communications with Alexa. And after it does that, the servlet delegates the actual interaction business logic to a <strong>Speechlet</strong>, which you must implement. You can see on line 11 that the Speechlet, which I named <code>HandlerSpeechlet</code>, is assigned to the servlet. This Speechlet will be invoked with every Alexa interaction.</p>
<p>A Speechlet is just a POJO that conforms to the SpeechletV2 interface that is defined in the Alexa Skills SDK. Here is what the interface looks like.</p>
<p>It’s your job to implement those four methods.</p>
<p>They’re all important, but most of the work happens in <code>OnIntent()</code>, which is invoked when the user says something meaningful. If you’re new to the vocabulary of Alexa programming, you should read <a target="_blank" href="https://medium.com/screenmedia-lab/utterances-slots-and-skills-the-new-vocabulary-needed-to-develop-for-voice-7428bff4ed79">Intents, Utterances, and Slots: The New Vocabulary Needed To Develop For Voice</a>.</p>
<h3 id="heading-defining-intents">Defining intents</h3>
<p>Jump into the <a target="_blank" href="https://developer.amazon.com/alexa">Alexa Developer Console</a>. Set up a new custom skill within the console — that part is very easy. I’ve named my skill “MyDemoApp”, and under the Invocation menu, I set the Skill Invocation Name to “my demo app”.</p>
<p>Recall earlier in this article I said that you can interact with our skill by saying things such as:</p>
<pre><code>Alexa, ask my demo app to tell me trivia about a random year.Alexa, ask my demo app, what happened <span class="hljs-keyword">in</span> the year <span class="hljs-number">1984</span>?
</code></pre><p>You can see that each of the above sentences start with the wake word (“Alexa”) and the Skill Invocation Name (“my demo app”).</p>
<pre><code>Alexa, ask my demo app ...
</code></pre><p>Everything after the Skill Invocation Name is known as an <strong>utterance</strong>. It’s your job to list utterances in the developer console, and map those to an intent. A single intent normally has many utterances, representing the variations a user might say. For example, all of the following utterances are essentially the same:</p>
<pre><code>tell me trivia about a random year.say something about any year.pick a random year.tell me some trivia.say anything about any year.
</code></pre><p>All of these utterances mean the same thing, and therefore can map to a single intent. In my application, I’ve called this the “RandomYearIntent”. Here’s what it looks like in the developer console.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*-jAvV7iIAAnBDazM_TGgTA.png" alt="Image" width="800" height="457" loading="lazy"></p>
<h3 id="heading-back-to-writing-code">Back to writing code</h3>
<p>With our first intent defined, it’s now time to jump back into our Spring application and write some code. Let’s edit our “HandlerSpeechlet”. For the moment, let’s skip the <code>onSessionStarted</code> and <code>onLaunch</code> methods of the Speechlet, and jump right into the <code>onIntent</code> method.</p>
<p>Because our application will eventually handle multiple intents, we’ll first need to determine which intent is being invoked.</p>
<p>On line 10, we now have the name of the intent. In our example so far, this should be <code>RandomYearIntent</code>. At this point, you might be tempted to write a bunch of <code>if-else</code> statements against the intent name, but let’s try something a little smarter.</p>
<p>By making sure that our intents follow a specific naming convention, we can use some Spring magic to load and invoke specialized handlers for each intent. What follows is not something specific to the Alexa Skills SDK. It’s just my own way of handling multiple intents. There are many ways to implement this logic. Here’s mine.</p>
<p>Let’s start by defining an interface which we’ll use for all of our handlers. Let’s create <code>IntentHandler</code> as:</p>
<p>Next, for each intent, we’ll create a class that implements this interface. We’ll also be careful to name our classes the same as the intent name, with the word “Handler” appended. For example, for the intent “RandomYearIntent”, we’ll create a class named <code>RandomYearIntentHandler</code><em>.</em></p>
<p>Okay, let’s leave this unimplemented for now. We’ll go back to our “HandlerSpeechlet” to add code that will pass control to our new “RandomYearIntentHandler”. The basic strategy is to rely on our naming convention of “IntentName” + “Handler”.</p>
<p>I have removed some details and error handling from the code below so that we can focus on the important bits. At the end of this article, you can find a link to my GitHub repo with the complete code.</p>
<p>Check out lines 12 and 13 below, which construct the class name, then ask Spring to find a registered bean with that name. Then, finally, on line 17, we pass control to that handler.</p>
<h3 id="heading-randomyearintenthandler">RandomYearIntentHandler</h3>
<p>We now have the plumbing in place to call our specialized intent handlers. Let’s go back to the implementation of our “RandomYearIntentHandler”. This particular intent is simple. Here’s the complete implementation.</p>
<p>Simple! Did you catch the annotation on line 1? That <code>@Component</code> annotation is a cool little trick that will tell Spring to create an instance of this class as a Bean. This is how we’re able to access the handler in our Speechlet, using <code>beanFactory.getBean(handlerBeanName)</code>.</p>
<p>On line 11 we create a random number between 1900 and the current year. Then we call the <a target="_blank" href="http://numbersapi.com/#42">Numbers API</a> to get trivia about that year.</p>
<p>On lines 14 and 15 we create a <code>Card</code> and a <code>Speech</code>. The <code>Card</code> is what is displayed in your Alexa mobile app — or on the screen in the Echo Show. The Speech is what is spoken back to the user.</p>
<p><code>AlexaUtils</code> is a simple class I created. I won’t go into the details here, but you can review it on <a target="_blank" href="https://github.com/raf66/AlexSpringBootWeb/blob/master/src/main/java/net/fiol/demo/alexa/utils/AlexaUtils.java">GitHub</a>.</p>
<h3 id="heading-that-was-easy-what-about-slots">That was easy — what about slots?</h3>
<p>Slots are basically <strong>variables in utterances</strong>. Look back at the two intents in our application. The second intent, which I’ll name “SpecificYearIntent”, allows the user to say any year. For example:</p>
<pre><code>Alexa, ask my demo app, what happened <span class="hljs-keyword">in</span> the year <span class="hljs-number">1984</span>?
</code></pre><p>In the above utterance, the year is highly variable. We do not want to define an utterance for every possible year. Instead, we’ll define this utterance using a slot, as:</p>
<pre><code>Alexa, ask my demo app, what happened <span class="hljs-keyword">in</span> the year {Year}?
</code></pre><p>{Year} represents a number. Jumping back into our developer console, we’ll setup a new “SpecificYearIntent” intent with its associated utterances as follows:</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*CDFfMDV8z_cQQeoSeMaisw.jpeg" alt="Image" width="800" height="530" loading="lazy">
<em>SpecificYearIntent utterances</em></p>
<p>I’ve defined a Slot named “Year”, which is of type “AMAZON.NUMBER”. Now, in my handler, I can fetch the slot value easily by name.</p>
<p>Line 13 is where we resolve the year <code>Slot</code>. The rest is all boilerplate Java code, which follows the same pattern as the first intent — call the NumbersAPI service for the year and handle the response.</p>
<h3 id="heading-sessions-and-state">Sessions and state</h3>
<p>I didn’t get into the <code>OnSessionStarted</code> or <code>OnLaunch</code> methods of the Speechlet in this article, but I did include an implementation for <code>OnLaunch</code> in the <a target="_blank" href="https://github.com/raf66/AlexSpringBootWeb">sample project in GitHub</a>.</p>
<p>You can use the <code>Session</code> object to store variables that will be retained across invocations when in conversation mode. Conversation mode occurs when the user invokes your skill but does not speak a recognized utterance. For example:</p>
<pre><code>Alex, open my demo app.
</code></pre><pre><code>&gt;&gt; Hello.  Here are some things you can say: Tell me something about a random year.  Or, what happened <span class="hljs-keyword">in</span> nineteen eighty-nine?
</code></pre><pre><code>What happened <span class="hljs-keyword">in</span> the year <span class="hljs-number">1984</span>?
</code></pre><pre><code>&gt;&gt; <span class="hljs-number">1984</span> is the year that the European Economic Community makes £<span class="hljs-number">1.8</span> million available to help combat the Ethiopian famine on October <span class="hljs-number">25</span>th.
</code></pre><pre><code>&gt;&gt; What <span class="hljs-keyword">else</span> can I tell you? Say <span class="hljs-string">"Help"</span> <span class="hljs-keyword">for</span> some suggestions.
</code></pre><pre><code>Cancel.
</code></pre><pre><code>&gt;&gt; OK.  Goodbye.
</code></pre><p>You’ll notice in my source code that I have a method named <code>setConversationMode</code>. It simply sets a variable in the Session, letting me know that we are in conversation mode.</p>
<h3 id="heading-summary">Summary</h3>
<p>Writing Alexa skills with Spring Boot is quite easy, and can be a powerful way to reuse your existing infrastructure. <a target="_blank" href="https://github.com/raf66/AlexSpringBootWeb">Download the complete app from GitHub</a> for more details.</p>
<p>And if you’re in the South Florida area, you can use my <a target="_blank" href="https://www.amazon.com/Rafael-Fiol-Cutler-Stew/dp/B0793FRYJG">Cutler Stew Skill</a> (built with Spring Boot) to learn when and where my band Cutler Stew is performing next.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to code sports games for Amazon Alexa, plus some fun games I built ]]>
                </title>
                <description>
                    <![CDATA[ By Terren Peterson I’m both a sports nut and a software engineer. I’m also recognized as an Amazon Alexa Champion. I continue to look for new ways to stretch this technology. Over the past two years, I’ve won hackathons for skills on the Alexa platfo... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-code-sports-games-for-amazon-alexa-and-some-fun-games-i-built-8179d2142f02/</link>
                <guid isPermaLink="false">66c350a0465d1b2f886ba42a</guid>
                
                    <category>
                        <![CDATA[ Alexa ]]>
                    </category>
                
                    <category>
                        <![CDATA[ amazon echo ]]>
                    </category>
                
                    <category>
                        <![CDATA[ sports ]]>
                    </category>
                
                    <category>
                        <![CDATA[ startup ]]>
                    </category>
                
                    <category>
                        <![CDATA[ technology ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Sat, 30 Sep 2017 20:34:15 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*2MZNttNYjigeKtg43OiPZA.jpeg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Terren Peterson</p>
<p>I’m both a sports nut and a software engineer. I’m also recognized as an Amazon <a target="_blank" href="https://developer.amazon.com/alexa/champions/terren-peterson">Alexa Champion</a>. I continue to look for new ways to stretch this technology.</p>
<p>Over the past two years, I’ve won <a target="_blank" href="https://en.wikipedia.org/wiki/Hackathon">hackathons</a> for skills on the Alexa platform.</p>
<p>Skills are the part of the Alexa voice service that activates its capabilities. In Alexa, <em>skill</em> is a term used for capabilities that make an experience more personal. You can enable or disable them as you choose. And, with the Alexa Skills Kit, You can create and customize them.</p>
<h3 id="heading-sports-games-are-an-enormous-market">Sports games are an enormous market</h3>
<p>Video games are a huge market, with annual revenues projected at more than <a target="_blank" href="https://newzoo.com/insights/articles/the-global-games-market-will-reach-108-9-billion-in-2017-with-mobile-taking-42/">$100B worldwide</a>. Shooter and action games are the most popular, <a target="_blank" href="http://marketrealist.com/2016/06/action-and-sports-genres-dominate-the-video-gaming-space/">followed by sports games</a>.</p>
<p>Voice platforms are growing at a fantastic rate. The popular Amazon Alexa platform has grown by 4 times in the past year. There are now 20,000 custom skills on the Alexa platform. Yet no sports games are more complex than calling out trivia.</p>
<p>Here is a sample of my new football game called <em>End Zone Football</em>. This shows how an advanced game can work on the Alexa platform.</p>
<h3 id="heading-begin-game-design-with-storyboards">Begin game design with Storyboards</h3>
<p>Designing the skill requires writing <a target="_blank" href="https://en.wikipedia.org/wiki/Storyboard">storyboards</a> to script the action. Start with how the game will begin. Then write the narrative for basic <a target="_blank" href="https://en.wikipedia.org/wiki/Gameplay">gameplay</a>.</p>
<p>Consider yourself to be a playwright or a movie director. Ask yourself: What should the native Alexa voice say? What sounds can be played that are part of the game?</p>
<p>Here’s what I learned from publishing a Baseball and Football game on Alexa. These tips will improve the usability of your game:</p>
<ul>
<li>Keep the interaction simple<br>yes or no and 1/2/3/4 answers work best</li>
<li>Identify sounds that can make the gameplay more exciting<br>Crowd cheering, whistles, or the crack of a bat</li>
<li>Simplify the game<br>The Baseball game skills should include foul balls<br>The Football game skills should simulate penalties<br>These help keep the user engaged</li>
<li>Don’t rely on visuals<br>A background image for the Echo Show is nice, but the images on the companion app should be secondary</li>
<li>Bound the game to 2–5 minutes<br>Users can play again and again if they have time</li>
<li>Create a help function that explains the game in detail<br>Give examples of phrases to use to play</li>
<li>Above all else<br>Make it Fun!</li>
</ul>
<h3 id="heading-learn-ssml-to-include-sounds-with-voice">Learn SSML to include sounds with voice</h3>
<p><a target="_blank" href="https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/speech-synthesis-markup-language-ssml-reference">Speech Synthesis Markup Language</a> (SSML) integrates sound with voice. It’s used to create the audio for the Alexa device.</p>
<p>This is how I set the main response attribute to call the Alexa API. After splicing the strings in JavaScript, the code looks like this:</p>
<pre><code><span class="hljs-keyword">var</span> speechOutput = “Welcome to End Zone Football. “ +   “&lt;audio src=\”” + bucketLoc + “BandMusicIntro.mp3\” /&gt;” +  “The game that lets you drive the “ +   “ball down the field using just your voice. “ +   “&lt;<span class="hljs-keyword">break</span> time=\”<span class="hljs-number">1</span>s\”/&gt;” +   “You are <span class="hljs-keyword">in</span> charge <span class="hljs-keyword">of</span> the Blackbears, and are down “ +  sessionAttributes.away + “ to “ + sessionAttributes.home + “. “ +   “&lt;<span class="hljs-keyword">break</span> time=\”<span class="hljs-number">1</span>s\”/&gt;” + “The ball is on the “ +   yardline + “ yardline. “ +   “When you are ready, just call out the play you want to run, and the game will begin. “ +   “For a list <span class="hljs-keyword">of</span> plays at anytime say, Read Playbook. “;
</code></pre><p>Here are some examples of how to use SSML in this context:</p>
<ul>
<li>To create a pause  </li>
<li>To insert a soundclip<br>&lt;audio src=”https://s3.amazonaws.../file.mp3"&gt;</li>
</ul>
<p>I recommend using an <a target="_blank" href="http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingBucket.html">S3 bucket</a> to store the media files. This is a low-cost way of storing data. And they can be accessible to Alexa.</p>
<h3 id="heading-state-management-tracks-the-progress-of-play">State management tracks the progress of play</h3>
<p>Alexa has the ability to store the gameplay state. Use this feature to simplify the coding and testing of your skill.</p>
<p>In the <a target="_blank" href="https://aws.amazon.com/sdk-for-node-js/">Node.js SDK</a>, a session attribute is passed with the request and response attributes. You can use the session attribute for the gameplay state. Store critical game information in this field. You can include anything, like the play number or recorded number of outs.</p>
<p>Here is an example used in the Football game</p>
<pre><code><span class="hljs-comment">// save the game attributes through to the next play    if (session.attributes) {          sessionAttributes = session.attributes;    }...</span>
</code></pre><pre><code><span class="hljs-comment">// gameplay rules for passingif (offensivePlaybook[i].playType === “pass” &amp;&amp;    offensivePlaybook[i].playNumber.toString() ===     intent.slots.playNumber.value) {       console.log(“Matched Play Number”);       // calculate pass distance based on play selected      passDistance = Math.round(Math.random() *         (offensivePlaybook[i].maxYardage            — offensivePlaybook[i].minYardage)            + offensivePlaybook[i].minYardage);       // make sure distance of play can’t be longer than       // the remaining field       if (passDistance &gt; sessionAttributes.yardline) {         passDistance = sessionAttributes.yardline;       }       playDesc = offensivePlaybook[i].playDesc;       speechOutput = speechOutput + playDesc + “. “;       // based on the play selected, determine relative       // completion rate       passCompletion = offensivePlaybook[i].completionRate;)...// pass back the response to Alexa, and save the gamestatecallback(sessionAttributes,                 buildSpeechletResponse(cardTitle, speechOutput,       cardOutput, repromptText, device, shouldEndSession));</span>
</code></pre><p>Storing this data in a table for analytics is helpful, but is not needed in an initial version. Let the Alexa platform do this work for you.</p>
<h3 id="heading-advertise-your-skill-on-social-media">Advertise your skill on social media</h3>
<p>People don’t yet realize all the things that an Alexa can do. When doing demos of these skills, I consistently get feedback that “I didn’t think Alexa could do that.”</p>
<p>All skills must be certified before publication on the Amazon Store. When your skill passes the certification process, take the time to record a video of it in action. It is the best way to prove what the platform is capable of.</p>
<p>Thank you for reading, and please enjoy these games — they’re free!</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How your code can be the voice of social good in the homes of 35 million people ]]>
                </title>
                <description>
                    <![CDATA[ By Drew Firment Coding for social good is a welcome movement. And it translates advancements in technology into social advancement for people everywhere. “Technology lets you see problems in ways my friends and I never could, and it empowers you to ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-your-code-can-be-the-voice-of-social-good-in-the-homes-of-35-million-people-a373a1e5c8ed/</link>
                <guid isPermaLink="false">66d45e41d14641365a0508aa</guid>
                
                    <category>
                        <![CDATA[ amazon echo ]]>
                    </category>
                
                    <category>
                        <![CDATA[ iot ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Life lessons ]]>
                    </category>
                
                    <category>
                        <![CDATA[ startup ]]>
                    </category>
                
                    <category>
                        <![CDATA[ technology ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Fri, 07 Jul 2017 20:42:00 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*vudic9m6hM2TOLCBLcWQpQ.jpeg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Drew Firment</p>
<p>Coding for social good is a welcome movement. And it translates advancements in technology into social advancement for people everywhere.</p>
<blockquote>
<p>“Technology lets you see problems in ways my friends and I never could, and it empowers you to help in ways we never could. You can start fighting inequity sooner, whether it is in your own community or in a country halfway around the world.” — Bill Gates, Letter to the Class of 2017</p>
</blockquote>
<p>Organizations like <a target="_blank" href="https://www.freecodecamp.org/news/how-your-code-can-be-the-voice-of-social-good-in-the-homes-of-35-million-people-a373a1e5c8ed/undefined">freeCodeCamp</a> are on the leading edge of this movement. The community brings together aspiring software developers to build open source projects. Their coding contributions to the projects help nonprofits carry out their missions more effectively.</p>
<p>Every day, coders around the world are making significant contributions toward solving social issues and supporting non-profits, human rights, global literacy, the environment, educators, or individuals in need.</p>
<h4 id="heading-speak-up">Speak Up!</h4>
<p>To help bring technologists together with social organizations that struggle with difficult challenges, <a target="_blank" href="https://www.freecodecamp.org/news/how-your-code-can-be-the-voice-of-social-good-in-the-homes-of-35-million-people-a373a1e5c8ed/undefined">A Cloud Guru</a> launched the <a target="_blank" href="https://read.acloud.guru/build-an-alexa-skill-to-speak-up-for-a-social-cause-and-win-a-lifetime-subscription-59bf9fe58f05">Alexa “Speak Up!” Challenge</a>.</p>
<p>The premise of the “Speak Up!” is simple — learn to code an Alexa skill, impact the greater good, and inspire change.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/RTyNcxo96j-gEO9fUqlkPt6oFBZWHvyW7Ns1" alt="Image" width="800" height="450" loading="lazy">
<em>Publish a skill by August 18th and enter the Alexa “Speak Up!” Challenge</em></p>
<h4 id="heading-be-the-voice-of-social-good">Be the voice of social good</h4>
<p>The challenge is inspired by Cameron Gallagher, the daughter of my close friend. Cameron’s dream was to create a 5k race in our community to raise awareness for teenage depression.</p>
<p>She planned for her race to be named the SpeakUp5k to let other teens like herself know that it was okay to <em>speak up</em> about their personal battles.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/S4tmY93JW8u-n-CmU1sKjTAcwMB1pSR2hpXY" alt="Image" width="760" height="405" loading="lazy">
<em>Cameron’s dream was to create a 5k race in her community to raise awareness of teenage depression</em></p>
<p>Before her SpeakUp5k could launch, sixteen-year-old Cameron passed away suddenly from an undiagnosed heart condition after crossing the finish line of a half-marathon.</p>
<p>During her final race, she looked at friend after struggling with cramps and said “<em>Let’s finish this.</em>” The <a target="_blank" href="http://www.ckgfoundation.org/camerons-story/">CKG Foundation</a> carries this message forward in her honor — and so does this challenge.</p>
<h3 id="heading-why-alexa">Why Alexa?</h3>
<p>The user base of voice-assisted devices is already very large — and growing fast. More than <em>35 million Americans</em> will use a voice-enabled speaker at least once per month in 2017. With over 70 percent of the U.S. market share, Amazon is currently dominating the voice-enabled speaker market.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/AsFukrM2d2zzpGxpv3oekMXkK31zZ03qUo2A" alt="Image" width="800" height="450" loading="lazy">
<em>Individuals of any age who use a voice-enabled speaker. Source: eMarketer, April 2017</em></p>
<p>By the end of 2020, Gartner’s expects that <em>75% of US households</em> will have a voice-enabled smart speaker. At that point, the install base of Alexa devices is forecasted to be <em>128 million users.</em></p>
<p>With a massive user base and a simple <a target="_blank" href="https://developer.amazon.com/alexa-skills-kit">Alexa Skills Kit (ASK)</a> for coders, the Amazon Echo provides software developers a powerful platform for amplifying your message of social good into the homes of millions of users worldwide.</p>
<h3 id="heading-lets-get-started-hello-word">Let’s get started — Hello Word</h3>
<p>Designing, developing and publishing an Alexa skill is really very easy — a basic skill can be completed within an hour.</p>
<ol>
<li>A Cloud Guru provides a <a target="_blank" href="https://acloud.guru/course/intro-alexa-free/dashboard">free Alexa course</a> that’ll walk you through the entire development process — from creating an account through publishing the skill.</li>
<li>Explore Amazon’s <a target="_blank" href="https://github.com/alexa">Alexa Github repository of templates</a> for simple guides that explain the basic building blocks and concepts of skill development.</li>
<li>Don’t have an Echo? No problem. <a target="_blank" href="https://echosim.io/">EchoSim.io</a> is a browser-based interface that allow developers to test their skills in development.</li>
</ol>
<p>Need some inspiration … just say <em>“Alexa, Inspire Me!”</em></p>
<h3 id="heading-how-to-measure-the-success-of-your-code">How to measure the success of your code?</h3>
<p>For any product in the early stages of development, it’s important to maintain focus by picking a single metric to measure progress. The <em>Lean Startup</em> movement advocates that startup use One Metric That Matters (OMTM) to track customer impact.</p>
<blockquote>
<p>The purpose of the OMTM is to track that the changes being made to the product are having a measurable impact on the behavior of your customers.</p>
</blockquote>
<p>For coders participating in the “Speak Up!” challenge, the OMTM is the number of customer lives touched by your sessions of social good. Once you’ve published an Alexa skill, the Amazon developer’s console provides a simple interface for tracking this metric.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/hU9mAmUULLWCAZYt5saNugVqHiywyUlsb6fV" alt="Image" width="800" height="299" loading="lazy">
<em>Metrics from my youngest daughter’s Harry Potter Alexa skill — Potterhead Sorting Ceremony</em></p>
<p>With millions of households listening, each invocation of your skills offers the potential to inspire, create awareness, and advance social good on a massive scale.</p>
<p>And now that <a target="_blank" href="https://developer.amazon.com/public/solutions/alexa/rewards-for-skill-developers">Amazon is offering incentives to developers of top gaming skills</a>, creating a fun and engaging Alexa skill for social good could also result in financial rewards to contribute to your cause. At the very least, your published skill will earn you some <a target="_blank" href="https://developer.amazon.com/alexa-skills-kit/alexa-developer-skill-promotion">free Alexa swag</a>!</p>
<blockquote>
<p>“You must be the change you wish to see in the world.” — Mahatma Gandhi</p>
</blockquote>
<p>Consider participating in the Alexa Speak Up! Challenge — learn to code an Alexa skill, impact the greater good, and inspire change.</p>
<p><em>“Let’s Finish This!”</em></p>
<p><em>Thanks for reading! If you like what you read, hold the <strong>clap button</strong> below so that others may find this. You can <a target="_blank" href="https://twitter.com/drewfirment">follow me on Twitter</a>.</em></p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to design and code Alexa skills for Amazon’s Echo Show ]]>
                </title>
                <description>
                    <![CDATA[ By Terren Peterson I’m an Amazon Alexa Developer Champion, and have published more than a dozen skills on the Alexa platform. This includes award winning skills like Hurricane Center, Scavenger Hunt, and Robot Roxie. The latest device added to the Am... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-design-and-code-alexa-skills-for-amazons-echo-show-c5716da8fee5/</link>
                <guid isPermaLink="false">66c351a20107ba195e79f707</guid>
                
                    <category>
                        <![CDATA[ amazon echo ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Design ]]>
                    </category>
                
                    <category>
                        <![CDATA[ General Programming ]]>
                    </category>
                
                    <category>
                        <![CDATA[ startup ]]>
                    </category>
                
                    <category>
                        <![CDATA[ technology ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Mon, 03 Jul 2017 04:46:54 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*HXEEbWxI_dUUCM3JoTDUAA.jpeg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Terren Peterson</p>
<p>I’m an <a target="_blank" href="https://developer.amazon.com/alexa/champions/terren-peterson">Amazon Alexa Developer Champion</a>, and have published more than a dozen skills on the Alexa platform. This includes award winning skills like <a target="_blank" href="https://read.acloud.guru/amazon-alexa-analytics-2355c359933b">Hurricane Center</a>, <a target="_blank" href="https://devpost.com/software/scavenger-hunt-ebvrck">Scavenger Hunt</a>, and <a target="_blank" href="https://www.hackster.io/contests/alexa-raspberry-pi">Robot Roxie</a>.</p>
<p>The latest device added to the Amazon Echo family features a screen that complements its audio experience. It’s called the Echo Show, and <a target="_blank" href="https://www.amazon.com/dp/B01J24C0TI#tech">here are the hardware specifications</a>. It features a 7" touchscreen display, a 5 Mega-pixel camera, and dual 2 inch stereo speakers.</p>
<p>In this article, I’ll show you how to design and code a new Alexa skill that takes advantage of this new hardware.</p>
<h3 id="heading-major-upgrades-to-the-software-platform">Major Upgrades to the Software Platform</h3>
<p>These hardware improvements required an upgrade to the underlying software running the platform. The Alexa Skills Kit (ASK) introduced a major release to power the added screen features. This is the largest set of enhancements to the ASK since the platform launched.</p>
<h4 id="heading-background-on-skill-building">Background on Skill Building</h4>
<p>If you’re not familiar with developing Alexa applications — called “Skills” — here’s a brief overview.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*l8Rl3UtrzvTagkgOYJZnEw.png" alt="Image" width="698" height="314" loading="lazy"></p>
<ul>
<li>A custom voice application interfaces with the natural language processing engine. This interprets audio commands provided by the user. Each application includes a customized intent model to direct the skills messages. A set of sample utterances train the voice recognition models which intent in the model to use.</li>
<li>A unique API receives all messages for the custom skill. Alexa requires a RESTful interface to be specified in the custom voice application. The skill author writes the API, and chooses the hosting platform. The preferred hosting platform is the AWS service Lambda. This is due to the slick compatibility of the security model across Amazon and low hosting costs. The API call contains a standard set of attributes relating the call made by the device. This contains data around the current invocation of the skill.</li>
</ul>
<p>Here is an example of a request to the Hurricane Center skill API:</p>
<pre><code>{  <span class="hljs-string">"session"</span>: {    <span class="hljs-string">"sessionId"</span>: <span class="hljs-string">"SessionId.5725be2d-99f8-4afd-909f-1f1d3882067a"</span>,    <span class="hljs-string">"application"</span>: {      <span class="hljs-string">"applicationId"</span>: <span class="hljs-string">"amzn1.echo-sdk-ams.app.709xxx"</span>    },    <span class="hljs-string">"attributes"</span>: {},    <span class="hljs-string">"user"</span>: {      <span class="hljs-string">"userId"</span>: <span class="hljs-string">"amzn1.ask.account.AFP3xxx"</span>    },    <span class="hljs-string">"new"</span>: <span class="hljs-literal">true</span>  },  <span class="hljs-string">"request"</span>: {    <span class="hljs-string">"type"</span>: <span class="hljs-string">"LaunchRequest"</span>,    <span class="hljs-string">"requestId"</span>: <span class="hljs-string">"EdwRequestId.260fd856-668f-4dd2-af9d-60d80e4cc8e0"</span>,    <span class="hljs-string">"locale"</span>: <span class="hljs-string">"en-US"</span>,    <span class="hljs-string">"timestamp"</span>: <span class="hljs-string">"2017-07-02T00:54:57Z"</span>  },  <span class="hljs-string">"version"</span>: <span class="hljs-string">"1.0"</span>}
</code></pre><p>The API for the custom skill processes the request, and responds with values for the Alexa device. The message model returned is a standard set of attributes, and written in JSON. The Alexa voice on the device reads the outputSpeech attribute.</p>
<p>Here is an example the corresponds to the call made to Hurricane Center skill above:</p>
<pre><code>{ “version”: “<span class="hljs-number">1.0</span>”, “sessionAttributes”: {} “response”: {     “outputSpeech”: {         “type”: “PlainText”,         “text”: “Welcome to the Hurricane Center, the best source <span class="hljs-keyword">for</span> information related to tropical storms, past or present. There are no active tropical storms right now, but <span class="hljs-keyword">if</span> you would like to learn more about storms, please say something like tell me a storm fact.”     },     “card”: {         “content”: “No Current Storms <span class="hljs-keyword">in</span> either the Atlantic or Pacific Ocean.”,         “title”: “Welcome to Hurricane Center”,         “type”: “Simple”     },     “reprompt”: {         “outputSpeech”: {             “type”: “PlainText”,             “text”: “Please tell me how I can help you by saying phrases like, list storm names or storm history <span class="hljs-keyword">for</span> <span class="hljs-number">2013.</span>”         }     }, }, “shouldEndSession”: <span class="hljs-literal">false</span> }}
</code></pre><h3 id="heading-what-changed-for-the-echo-show">What Changed for the Echo Show?</h3>
<p>To leverage the new visual features of the Show, the model for the response expanded. The model now includes new attributes to use the new hardware features. The custom written API for the skill includes these attributes in its response.</p>
<p>New templates supporting different use cases for the screen are central to it. These templates enable the Show to augment the voice experience. Full detail on these changes is available on the <a target="_blank" href="https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/display-interface-reference">Amazon Developer website</a>.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*HXEEbWxI_dUUCM3JoTDUAA.jpeg" alt="Image" width="800" height="600" loading="lazy"></p>
<h4 id="heading-six-visual-templates-to-choose-from">Six visual templates to choose from</h4>
<p>There are six templates available with the initial launch of the new ASK. Each template provides the ability to leverage the touch screen on the Echo Show. There are two types of templates. Four of them provide basic usage of the screen, the other two templates add the ability to manage lists of data. The skill developer selects which template is most applicable for each use case.</p>
<h4 id="heading-echo-show-supports-basic-html-tagging">Echo Show supports basic HTML tagging</h4>
<p>The Alexa platform already has a visual option before these changes. This is within the mobile application on your device pairs with — named the companion app. This performed initial setup and configuration by pairing with the device. Some skills use it to complement the voice first user experience. Here is what it looks like for Hurricane Center.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*AZ5Cu5hXnLC3wLgo2K030Q.png" alt="Image" width="308" height="541" loading="lazy"></p>
<p>The companion application has limits in how it can render information. All words on the screen are plain text. It does not support HTML, including changing the font type, font size, underlining, etc.</p>
<p>An optional small image displays on the screen that changes with each voice response. Usability on the app is poor when rendering a large amount of data given the clear text constraint. Usability is also poor when rendering lists of data which may be important to the narrative of the skill.</p>
<p>Within the templates of the new ASK, both simple text and basic HTML syntax are now supported. Pairing this with the list template provides a whole new level of user experience.</p>
<h4 id="heading-new-intents-to-handle-touch-events">New intents to handle touch events</h4>
<p>The screen on the Echo Show does more than act as a display, it also has touch sensors. Interacting with the screen creates events along with audible utterances. These include, back-button, right, left, etc. as the user can gesture with text and lists on the screen.</p>
<p>The device handles most of the new standard intents. They can be incorporated into your skill when rendering lists.</p>
<h3 id="heading-existing-skills-work-on-the-new-device">Existing Skills work on the new Device</h3>
<p>All 15,000 existing skills on the platform work with the Echo Show. They will use information that is currently rendered on the companion application. Here is an example with the Hurricane Center skill.</p>
<p>The skill works, but the usability of the screen is poor as the font is too large. The screen shows the same information that shared with the companion application. Without changes, it isn’t using a template, so there is no scrolling enabled in case the user wants to read the full text.</p>
<p>For reference, here is the GitHub repo that contains the entire source code for this skill.</p>
<p><a target="_blank" href="https://github.com/terrenjpeterson/hurricane"><strong>terrenjpeterson/hurricane</strong></a><br><a target="_blank" href="https://github.com/terrenjpeterson/hurricane">_Alexa Skill for providing hurricane updates_github.com</a></p>
<h3 id="heading-extreme-makeover-echo-show-edition">Extreme Makeover — Echo Show Edition</h3>
<p>Here are the steps required to take advantage of the new features in the ASK. These changes will leverage the hardware capabilities for users with an Echo Show.</p>
<h4 id="heading-step-1-activate-template-feature-for-the-skill">Step 1 — Activate template feature for the skill</h4>
<p>Activating it for a skill requires selecting a radio button on a new or existing skill. There is a new indicator to “Render Template”. Once it is set, the skill can now leverage the extra abilities of the Echo Show.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*IocU0ynDy34VsyFyEXZq0Q.png" alt="Image" width="496" height="292" loading="lazy"></p>
<h4 id="heading-step-2-select-a-template-then-add-attributes-to-the-api-response">Step 2 — Select a template, then add attributes to the API response</h4>
<p>The ASK now contains templates outlining the visual patterns supported by the Echo Show. These map to different UI patterns, including displaying images and lists. There is good <a target="_blank" href="https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/display-interface-reference">reference documentation</a> on the Amazon developer website.</p>
<p>For my Hurricane Center skill, I’ve chosen to use the “BodyTemplate1” for the main display. This takes advantage of the ability to display a background image on the Show. It also renders an improved user experience for the textual response. Here are the new attributes to include to the existing JSON response.</p>
<pre><code>directives: [ {   <span class="hljs-attr">type</span>: “Display.RenderTemplate”,   <span class="hljs-attr">template</span>: {       <span class="hljs-attr">type</span>: “BodyTemplate1”,       <span class="hljs-attr">token</span>: “T123”,       <span class="hljs-attr">backButton</span>: “HIDDEN”,       <span class="hljs-attr">backgroundImage</span>: {           <span class="hljs-attr">contentDescription</span>: “StormPhoto”,           <span class="hljs-attr">sources</span>: [               {                  <span class="hljs-attr">url</span>: “https:<span class="hljs-comment">//s3.amazonaws.com/hurricane-data/hurricaneBackground.png”               }           ]      },      title: “Hurricane Center”,      textContent: {          primaryText: {              text: cardInfo,              type: “PlainText”          }      }  }}],</span>
</code></pre><p>The background image used matches the dimensions of the Echo Show — 1024 x 600 pixels. Hosting images follows the same pattern as with the companion application. The image object needs to be accessible from the internet without any authentication.</p>
<h4 id="heading-step-3-publish-a-new-version-of-the-skill">Step 3 — Publish a new version of the skill</h4>
<p>Rendering templates changes the skill, requiring to go through the certification process again. It doesn’t need publishing a separate skill for the new device. This means all the prior ratings and users that have enabled it on their accounts will carry forward. Test the skill on other devices to make sure that nothing broke.</p>
<h3 id="heading-new-version-of-the-skill">New Version of the Skill</h3>
<p>Here is what the hurricane skill looks like after the work described above.</p>
<p>The photo now appears as a background image rather than the default canvas. The text intended for the companion application renders on the Echo Show screen. The font size is appropriate, in a readable format. This is a major improvement in usability, with not a significant effort in coding.</p>
<h3 id="heading-backwards-compatibility-for-all-devices">Backwards Compatibility for all Devices</h3>
<p>We want the skill to continue to work for existing devices given that the Echo Show is new. That requires a little extra logic when formatting the response in the API. The interface contract requires the API provide only attributes readable by the device. This means extra attributes intended for the Echo Show creates errors when sent to an earlier Echo.</p>
<p>Stopping this error requires interpreting the context section of the native request object. This section provides information about the device, including if it contains a display. This attribute is only present with an Echo Show. If this attribute is not present, the API excludes the directives attribute. Here is a sample of a request from the Hurricane Center skill generated by an Echo Show.</p>
<pre><code>“context”: {     “AudioPlayer”: {         “playerActivity”: “STOPPED”     },     “Display”: {         “token”: “T123”     },     “System”: {         “application”: {             “applicationId”: “amzn1.echo-sdk-ams.app<span class="hljs-number">.709</span>xxx”         },         “user”: { “userId”: “amzn1.ask.account.AFP3xxx” },         “device”: {             “deviceId”: “amzn1.ask.device.AFAQxxx”,            “supportedInterfaces”: {                 “AudioPlayer”: {},                 “Display”: {                     “templateVersion”: “<span class="hljs-number">1.0</span>”,                     “markupVersion”: “<span class="hljs-number">1.0</span>”                 },             “VideoApp”: {}         }     },}
</code></pre><p>In the example above, the System.device.supportedInterfaces.Display attribute exists, indicating that the request is originated by an Echo Show. Here is the request from the same skill generated by an Echo Dot.</p>
<pre><code>“context”: {     “AudioPlayer”: {        “playerActivity”: “IDLE”     },     “System”: {         “application”: {            “applicationId”: “amzn1.echo-sdk-ams.app<span class="hljs-number">.709</span>xxx”         },         “user”: { “userId”: “amzn1.ask.account.AFP3xxx” },         “device”: {             “deviceId”: “amzn1.ask.device.AFAQxxx”,             “supportedInterfaces”: {                 “AudioPlayer”: {}             }         },         “apiEndpoint”: “https:<span class="hljs-comment">//api.amazonalexa.com”     } }</span>
</code></pre><p>In the second example, there are no display attributes. That’s easy to recognize, and now reflected in my skill.</p>
<h3 id="heading-whats-next">What’s Next?</h3>
<p>It’s amazing the speed at which the platform is growing. There are now 15,000 custom skills available for users to try out. The hardware options are enabling even deeper user experiences. I will be spending the next few months porting over my skills to the new platform. Hope this helps updating yours!</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ I needed a guitar teacher. So I turned my Alexa into one. ]]>
                </title>
                <description>
                    <![CDATA[ By Terren Peterson Learning how to play guitar takes practice. A lot of practice. One of my self-improvement goals is to get better playing the guitar. An area I’m working on now is finger positioning on the fretboard. This requires memorization of d... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/who-can-teach-you-the-guitar-better-youtube-or-alexa-96e8cef77470/</link>
                <guid isPermaLink="false">66c3666cb737bb2ce7073203</guid>
                
                    <category>
                        <![CDATA[ amazon echo ]]>
                    </category>
                
                    <category>
                        <![CDATA[ music ]]>
                    </category>
                
                    <category>
                        <![CDATA[ self-improvement  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ tech  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ technology ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Mon, 03 Apr 2017 21:18:41 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*-vVeRVJfQZb2IgpH2RBJyQ.jpeg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Terren Peterson</p>
<p>Learning how to play guitar takes practice. A lot of practice. One of my self-improvement goals is to get better playing the guitar.</p>
<p>An area I’m working on now is finger positioning on the fretboard. This requires memorization of different patterns of where to touch the strings. Improvement takes frequent practice and coaching, but is quite rewarding.</p>
<p>Researching what’s available on the internet showed me many musicians lending a hand. A popular medium where they are sharing is YouTube. The video below has more than five million views, demonstrating the broad usage. The instructor steps through the basics of finger positioning and notes.</p>
<p>These videos are great for getting started, but what gets lost is how to focus completely on the music. Focusing my attention on finger placement and note recognition is how I move forward.</p>
<p>I tried different YouTube artists in an attempt to find the perfect coach. The limitation I continue to run into is not the artist or the audio quality of the device. Rather the limitation is the medium itself of a video playing on my phone or laptop. When practicing, I never get any exercise correct in the first attempt. Given the interface of YouTube, it’s difficult to playback sections given that my hands are on my guitar.</p>
<h3 id="heading-so-i-built-the-alexa-guitar-teacher-skill"><strong>So I built the Alexa Guitar Teacher Skill</strong></h3>
<p>This highlights where interactive voice applications are better than traditional mobile platforms. A voice application doesn’t need use of your hands. Playback of a section requires my voice, and my hands stay on the guitar. For learners like me that need to repeat lessons to get them correct, being hands-free is a huge asset.</p>
<p>I tried out what was available in the skill store, but found skills that were very simplistic . Some didn’t even feature the sound of a guitar, rather a monotone voice giving instructions. So I did what any software engineer would do, and came up with one myself called “<a target="_blank" href="https://www.amazon.com/Drawrz-com-Guitar-Teacher/dp/B01N805N3E/ref=sr_1_1?s=digital-skills&amp;ie=UTF8&amp;qid=1489286872&amp;sr=1-1&amp;keywords=guitar+teacher">Guitar Teacher</a>”.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*ZjxeaGi4Js4i5UqxCh6KTQ.png" alt="Image" width="367" height="307" loading="lazy"></p>
<p>The Alexa platform has the ability to interact with someone using only their voice. This frees up fingers to focus on playing the strings. Here’s a quick demonstration of the skill with some of the core features.</p>
<h3 id="heading-how-does-it-work">How does it work?</h3>
<p>Despite what you see with most skills on the platform, Alexa can do more than speak words. More complex voice applications use a syntax known as SSML. This mixes together the machine voice with sounds that recorded to a Mp3 file.</p>
<p>Here’s the syntax required that uses Alexa to explain how to position your fingers to play a standard chord. This section of the code plays sound of the chord to reinforce what comes out of an actual guitar.</p>
<pre><code>{“outputSpeech”: {“type”: “SSML”,“ssml”:“&lt;speak&gt;Okay, <span class="hljs-keyword">let</span>’s get started on how to play the chord C Major.&lt;audio src=\”https:<span class="hljs-comment">//s3.amazonaws.com/.../Chordcmajor.mp3\" /&gt;&lt;break time=\”1s\”/&gt;Here are the finger positions. Your index finger will be on string 2 pressing down on fret 1.&lt;break time=\”2s\”/&gt;Your middle finger will be on string 4 pressing down on fret 2.&lt;break time=\”2s\”/&gt;Finally, your ring finger will be on string 5 pressing down on fret 3.&lt;break time=\”2s\”/&gt;Now go ahead and play the chord C Major.&lt;break time=\”1s\”/&gt;&lt;audio src=\”https://s3.amazonaws.com/.../Chordcmajor.mp3\" /&gt;One more time.&lt;break time=\”1s\”/&gt;&lt;audio src=\”https://s3.amazonaws.com/.../Chordcmajor.mp3\" /&gt;&lt;break time=\”2s\”/&gt;If you’re ready for another chord to learn, please ask for it now.For example, say Teach me how to play A Major.&lt;/speak&gt;”}}</span>
</code></pre><h3 id="heading-using-visuals-to-complement-the-audio-experience">Using visuals to complement the audio experience</h3>
<p>A well written skill shares visuals by pushing cards to the companion app on the users phone or tablet. These visuals reinforce the audio delivered, and complement the content.</p>
<p>Below is an example of a card that displays how to position each finger on the guitar when playing a chord. The audio provides explicit details using voice instructions to the user. The visual reinforces the message using another medium. The diagram included is a standard notation used by guitar players.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*XczNUsPCWSQHtJzPARL9zA.png" alt="Image" width="362" height="332" loading="lazy"></p>
<p>There are also cards showing the location on the fretboard of different notes. Once again, this reinforces what is being described through the audio of the skill.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*uG-tfMa6PvjSrDwT0yo6zQ.png" alt="Image" width="343" height="339" loading="lazy"></p>
<p>These cards contain similar content to graphics embedded in YouTube videos.</p>
<p>One advantage is that these cards display salient information without using your hands. Rewinding the skill with to play back a previous session also replays the cards. Your voice completely drives the narration. No buttons, hand gestures, or mouse clicks hit the back button or similar actions. Fingers focus on plucking and pressing down strings to create music.</p>
<h3 id="heading-what-feature-is-alexa-missing">What feature is Alexa missing?</h3>
<p>It’s still early in the adoption of voice platforms. I’d expect to see more applications like mine that take advantage of the voice interface. Gaps exist where apps exclusive to a mobile device are superior.</p>
<p>One feature for Alexa is enabling the raw sound data from the microphones to the application. Today Alexa translates every sound directly to text. This limits the ability for the platform to listen to tones when I play the instrument. Helpful mobile apps validate the sounds played, and let the user know the correct tones.</p>
<h3 id="heading-feedback-welcome">Feedback Welcome</h3>
<p>If you’re an aspiring musician like me and have an Alexa device, please give the skill a try. Like all Alexa skills, it’s free to enable. It would be great to have some feedback on what’s useful and other features to add. I’m still learning the instrument, so I also welcome any advice on what’s missing from the skill.</p>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
