Alexa Blogs Alexa Developer Blogs /blogs/alexa/feed/entries/atom 2018-11-13T19:00:38+00:00 Apache Roller /blogs/alexa/post/80d6dbee-87cc-4ba6-906e-aa17ff1d4a5c/use-new-slot-validation-to-simplify-dialog-management Use New Slot Validation to Simplify ASK Dialog Management BJ Haberkorn 2018-11-13T18:46:39+00:00 2018-11-13T19:00:38+00:00 <p><img alt="" src=" https://m.media-amazon.com/images/G/01/DeveloperBlogs/AlexaBlogs/AlexaSkillsKit/slot_validation_blog.png._CB479730393_.png" style="height:480px; width:1908px" /></p> <p>Now Alexa can automatically re-prompt your users who provide unacceptable slot values in delegated dialogs.</p> <p><img alt="" src=" https://m.media-amazon.com/images/G/01/DeveloperBlogs/AlexaBlogs/AlexaSkillsKit/slot_validation_blog.png._CB479730393_.png" /></p> <p>We’re excited to announce slot validation, a new Alexa Skills Kit (ASK) dialog management feature available for developers to use in all ASK locales. When you enable slot validation for dialogs that you delegate to Alexa, Alexa will check slot values collected against an acceptable set you define, and automatically re-prompt users who provide a response outside that set. As a result, you can eliminate validation and re-prompting code in your skill back end. This simplifies your development and results in a more consistent experience for customers.</p> <h2>Use Dialog Management to Manage Multi-Turn Conversations</h2> <p>Dialog management makes it easier for your skill to handle variations of conversation, conditional collection of data, and context switching, without losing track of what’s being said. Dialog management keeps track of the slots that you tell it to collect, and uses a state machine to manage the state of the conversation, including what information has and hasn’t been collected. You can either delegate the dialog to Alexa, using the Dialog.Delegate directive, or control each step of the dialog yourself, using Dialog.ElicitSlot, Dialog.ConfirmSlot, and Dialog.ConfirmIntent. You can learn more in the <a href="https://build.amazonalexadev.com/alexa-skill-dialog-management-guide-ww.html">Alexa Skill Builder’s Guide: Advanced Skill Building with Dialog Management</a>.</p> <h2>Let Alexa Validate Slots for You</h2> <p>The new slot validation feature is available for dialogs that you delegate to Alexa. With slot validation, you define rules that specify the acceptable values for a slot, along with specific prompts for eliciting a new value. You can set relative and absolute range validations for number and date/time slots, and enumerated lists of values to allow or exclude for list and custom slots. For custom slots, you can also allow only values specifically enumerated in your custom values and synonyms. When a user speaks a slot value that does not meet your validation criteria, the prompts you define will be used by ASK dialog management to ask for a new value.</p> <p style="text-align:justify">For example, if your skill has a list of color options that includes “red,” “green,” and “blue,” you can configure slot validation to only accept these colors from the user. If a user tells your skill, “I want the color orange,” slot validation will reply with the prompt you provide for this rule, such as, “We only have red, green, and blue. Which of these would you like?” When the user replies with an acceptable color option, the dialog will proceed to the next step. If the user fails to provide a valid slot after two re-prompts, the skill session will end.</p> <h2>Learn More and Get Started Today</h2> <p>Slot validation is available in all locales supported by Alexa, and is available through the skill builder in the Alexa Developer Console and Skill Management API (SMAPI). To learn how to use slot validation in your skills, read the&nbsp;<a href="https://developer.amazon.com/blogs/alexa/post/c605b7d1-9953-4c90-b049-1ad7b86ef816/building-conversational-alexa-skills-validating-slots-with-dialog-management">Building Conversational Alexa Skills: Validating Slots with Dialog Management</a>&nbsp;blog and our <a href="https://developer.amazon.com/docs/custom-skills/validate-slot-values.html">Validate Slot Values documentation</a>.</p> <h2>Related Resources</h2> <ul> <li><a href="https://developer.amazon.com/docs/custom-skills/validate-slot-values.html">Validate Slot Values</a></li> <li><a href="https://developer.amazon.com/blogs/alexa/post/dbceb5dd-3c4d-40f1-be22-172f4050fbcb/building-conversational-alexa-skills-how-to-dynamically-elicit-slots-based-on-a-previous-answer-using-dialog-management">How to Dynamically Elicit Slots Based on a Previous Answer Using Dialog Management</a></li> <li><a href="https://developer.amazon.com/blogs/alexa/post/efd1fd50-84fe-4e48-97e2-a61ad0612bc3/building-conversational-alexa-skills-confirming-slots-with-dialog-management">Confirming Slots with Dialog Management</a></li> <li><a href="https://developer.amazon.com/alexa-skills-kit/dialog-management">Build Advanced Alexa Skills Using Dialog Management</a></li> <li><a href="https://build.amazonalexadev.com/alexa-skill-dialog-management-guide-ww.html">Guide: Advanced Skill Building with Dialog Management</a></li> </ul> /blogs/alexa/post/c605b7d1-9953-4c90-b049-1ad7b86ef816/building-conversational-alexa-skills-validating-slots-with-dialog-management Building Conversational Alexa Skills: Validating Slots with Dialog Management Jennifer King 2018-11-13T18:45:41+00:00 2018-11-13T18:49:04+00:00 <p>In this technical post, I build upon the coffee shop skill and share how you can simplify dialog management with the new slot validations feature.</p> <p>In my previous post <a href="https://developer.amazon.com/blogs/alexa/post/efd1fd50-84fe-4e48-97e2-a61ad0612bc3/building-conversational-alexa-skills-confirming-slots-with-dialog-management">on confirming slots with dialog management</a>, I walked through extending our coffee shop sample skill to dynamically confirm a slot with the <strong>Dialog.ConfirmSlot</strong> directive. If the customer orders <strong>coffee</strong>, our skill's back end returns the <strong>Dialog.ElicitSlot</strong> directive to elicit the <strong>flavor</strong> slot. The <strong>flavor</strong> costs $0.50 so we use the <strong>Dialog.ConfirmSlot</strong> directive to seek confirmation of the additional charges.</p> <p>At the end of the post, I pointed out that there could be a potential problem. What if the user asked for water? That's still a drink, but what if they asked for baseball, unicorns, or lamp? We're going to have to reprompt the customer to provide us with valid value.</p> <p>We're going to need to do something to validate the data. I also encouraged you to think about how you would solve the problem on your own. I asked, what handlers would you need? How would you re-elicit the slot? What dialog directives would you need?</p> <p>To solve this problem, I would have created a helper function that given a slot and a set of rules returns true if the slot value is valid. Then I would have created a handler that would determine if a given slot value was invalid and, if so, re-elicit the slot using the <strong>Dialog.ElicitSlot</strong> directive. However, earlier this week, <a href="https://developer.amazon.com/blogs/alexa/post/80d6dbee-87cc-4ba6-906e-aa17ff1d4a5c/use-new-slot-validation-to-simplify-dialog-management">we announced slot validations for dialog management</a>, which means we actually don't need to write any code as long as our skill is returning the <strong>Dialog.Delegate</strong> directive. What line of code never breaks, never needs to be tested and never needs to be rewritten? Answer: the line of code you never wrote!</p> <p>Before we go too deep into slot validation with dialog management, let's recap the coffee shop skill.</p> <h2>Recap: The Coffee Shop Skill</h2> <p>Our coffee shop skill allows the customer to order <strong>coffee</strong> or <strong>tea</strong>. Based upon their <strong>drink</strong> of choice, the skill either asks what kind of coffee roast (<strong>coffeeRoast</strong>) or type of tea (<strong>teaType</strong>) they want. Furthermore, if they ordered coffee, the skill uses the <strong>Dialog.ElicitSlot</strong> directive, to ask the customer if they want to add a <strong>flavor</strong>. They can turn down a flavor by saying, &quot;no thanks.&quot; But if they choose a flavor, the skill uses the <strong>Dialog.ConfirmSlot</strong> directive to seek confirmation of an additional $0.50 for adding the flavor.</p> <p>Let's take a look at how we would update our coffee shop skill to automatically validate and prompt for our drink slot if the customer choose an invalid option without any additional code.</p> <h2>Setting Up Your Skill’s Interaction Model</h2> <p>Now that the slot validation feature has been released, the build tab in the <a href="https://developer.amazon.com/alexa/console/ask">developer portal</a> has been updated so you can add turn on validations. From the <strong>OrderIntent</strong>, select the <strong>drink</strong> slot and you'll see two tabs labeled, one labeled <strong>Dialogs</strong> and the other <strong>Validations</strong>. Click on the <strong>Validations</strong> tab and you will be able to create validations rules for your slot.</p> <p><img alt="" src="https://m.media-amazon.com/images/G/01/DeveloperBlogs/AlexaBlogs/default/slot_validation_interaction_model_image.png._CB479978418_.png" style="display:block; height:379px; margin-left:auto; margin-right:auto; width:1000px" /></p> <p>There are three validation rules you can choose from:</p> <ol> <li>Accept only a set of values</li> <li>Reject only a set of values</li> <li>Accept only Slot Type's values and synonyms</li> </ol> <p>These rules help you dictate how to validate the slot value. For our coffee shop skill, we'll use the third option, &quot;Accept only Slot Type's values and synonyms.&quot; This option allows us to define synonyms and have the validator use those in addition to the values to validate what our customer has said.</p> <p>Upon selecting that option, we'll need to draft some prompts that Alexa will say to re-elicit the slot. To do that, let's think about what Alexa would say if the <strong>drink</strong> slot was <strong>shoes</strong>:</p> <ul> <li><code>I'm sorry but shoes is not something we offer. Which would you like coffee or tea?</code></li> <li><code>Whoops. I'm afraid we don't serve shoes. Which would you like coffee or tea?</code></li> <li><code>Oops! Shoes is not an option. Which would you like, coffee or tea?</code></li> <li><code>Sorry but shoes is not an option. Which would you like, coffee or tea?</code></li> </ul> <p>While looking through the examples, you may have noticed that each example includes, &quot;Which would you like, coffee or tea?&quot; We include this as the prompt that Alexa will ask the customer when re-eliciting the <strong>drink</strong> slot. The other thing that these examples have in common is the mention of &quot;shoes.&quot; This is a best practice since we are using an implicit confirmation to communicate to the customer that we heard what they asked for, but it's not a valid choice. When we define our samples, how do we repeat our customer's invalid selection without knowing what they'll say ahead of time? Simple: we use the slot. In this case we are validating the <strong>drink</strong> slot so we'll use that in our sample utterances:</p> <ul> <li><code>I'm sorry but {drink} is not something we offer. Which would you like, coffee or tea?</code></li> <li><code>Whoops. I'm afraid we don't serve {drink}. Which would you like, coffee or tea?</code></li> <li><code>Oops! {drink} is not an option. Which would you like, coffee or tea?</code></li> <li><code>Sorry but {drink} is not an option. Which would you like, coffee or tea?</code></li> </ul> <p>Now that we've converted the sample utterances and added them to our model, we'll save and build the model.</p> <p><img alt="" src="https://m.media-amazon.com/images/G/01/DeveloperBlogs/AlexaBlogs/default/dm_slots_second_image.png._CB479978380_.png" style="display:block; height:749px; margin-left:auto; margin-right:auto; width:800px" />While we don't have to write any additional code to do the validation checks, our skill needs to return the <strong>Dialog.Delegate</strong> directive in order to have the Alexa service automatically validate and re-elicit the slot if the slot is invalid.</p> <h2>Updating Your Skill’s Back End</h2> <p>We need to return the <strong>Dialog.Delegate</strong> directive. Our skill's handler functions check for a variety of use cases. Remember our <strong>StartedInProgressOrderIntentHandler</strong> handler? It's <strong>canHandle</strong> function returns true if:</p> <p>request.type <strong>equals</strong> IntentRequest request.intent.name <strong>equals</strong> OrderIntent request.dialogState <strong>not equals</strong> COMPLETED</p> <p>The handle function returns the <strong>Dialog.Delegate</strong> directive, which is exactly what we need to have Alexa handle validating the <strong>drink</strong> slot for us. Therefore, our back end is complete and we don't need to update our code.</p> <p>Translated to code, our <strong>StartedInProgressOrderIntentHandler</strong> appears below:</p> <pre> <code class="language-javascript">const StartedInProgressOrderIntentHandler = { canHandle(handlerInput) { return handlerInput.requestEnvelope.request.type === &quot;IntentRequest&quot; &amp;&amp; handlerInput.requestEnvelope.request.intent.name === &quot;OrderIntent&quot; &amp;&amp; handlerInput.requestEnvelope.request.dialogState !== 'COMPLETED'; }, handle(handlerInput) { return handlerInput.responseBuilder .addDelegateDirective() .getResponse(); } }</code></pre> <p><strong>Note: </strong>Dialog management validations only support the <strong>Dialog.Delegate </strong>directive, so if you return a <strong>Dialog.ElicitSlot</strong> directive, the validations won’t be run on the slot that was elicited. For example, since we use <strong>Dialog.ElicitSlot</strong> to elicit flavor after we receive a value for <strong>coffeeRoast</strong>, validations will not be run on <strong>Dialog.ElicitSlot</strong>.</p> <p>Now that you've read through this post, try to think about how you can put these techniques and features to use in your own skills. Let's continue the discussion online! You can find me on Twitter <a href="https://twitter.com/sleepydeveloper">@SleepyDeveloper</a>.</p> <h2>Related Resources</h2> <ul> <li><a href="https://developer.amazon.com/docs/custom-skills/validate-slot-values.html">Validate Slot Values</a></li> <li><a href="https://developer.amazon.com/blogs/alexa/post/80d6dbee-87cc-4ba6-906e-aa17ff1d4a5c/use-new-slot-validation-to-simplify-dialog-management">Use the Slot Validation to Simplify Dialog Management</a></li> <li><a href="https://developer.amazon.com/blogs/alexa/post/dbceb5dd-3c4d-40f1-be22-172f4050fbcb/building-conversational-alexa-skills-how-to-dynamically-elicit-slots-based-on-a-previous-answer-using-dialog-management">How to Dynamically Elicit Slots Based on a Previous Answer Using Dialog Management</a></li> <li><a href="https://developer.amazon.com/blogs/alexa/post/efd1fd50-84fe-4e48-97e2-a61ad0612bc3/building-conversational-alexa-skills-confirming-slots-with-dialog-management">Confirming Slots with Dialog Management</a></li> <li><a href="https://developer.amazon.com/alexa-skills-kit/dialog-management">Build Advanced Alexa Skills Using Dialog Management</a></li> <li><a href="https://build.amazonalexadev.com/alexa-skill-dialog-management-guide-ww.html">Guide: Advanced Skill Building with Dialog Management</a></li> </ul> /blogs/alexa/post/5d08880b-2a89-44e3-b5c2-8ebed1b0511d/steven-arkonovich-adds-in-skill-purchasing-to-personalize-alexa-skills-and-boost-his-voice-business Steven Arkonovich Adds In-Skill Purchasing to Personalize Alexa Skills and Boost His Voice Business Jennifer King 2018-11-13T16:00:00+00:00 2018-11-13T16:00:00+00:00 <p><img alt="" src="https://m.media-amazon.com/images/G/01/DeveloperBlogs/AlexaBlogs/default/Steve_A_Blog_Header.png._CB479747321_.png" /></p> <p>With over 60,000 active monthly users, Big Sky has earned Steven Arkonovich both income and publicity. But when in-skill purchasing became available, he saw the opportunity to build a sustainable revenue stream by selling&nbsp; premium, personalized content to customers.</p> <p style="text-align:center"><iframe allowfullscreen="" frameborder="0" height="360" src="//www.youtube.com/embed/w3ZZF0b6HeQ" width="640"></iframe></p> <p>When philosophy and ethics professor Steven Arkonovich first experienced voice technology, he never imagined he’d create one of <a href="https://www.cnet.com/how-to/the-first-alexa-skills-you-should-enable/" target="_blank">CNET's seven “must-have” Alexa skills</a>. With over 60,000 active monthly users, that skill—<a href="https://www.amazon.com/Philosophical-Creations-Big-Sky/dp/B01GU4MBM4/" target="_blank">Big Sky</a>—has earned the <a href="https://developer.amazon.com/alexa/champions/steven-arkonovich">Alexa Champion</a> both income and publicity. But when <a href="https://developer.amazon.com/alexa-skills-kit/make-money/in-skill-purchasing">in-skill purchasing</a> became available, he saw the opportunity to build a sustainable revenue stream by selling &nbsp;premium, personalized content to customers.</p> <p>“Allowing users to customize their experience fits so naturally with what people expect from voice technology,” says Arkonovich. “Being able to monetize such features gives developers even more incentive to take their skills and their business to the next level.”</p> <p>His Big Sky skill provides “better weather for Alexa,” according to Arkonovich, delivering personalized weather information with just the amount of detail the customer asks for. With in-skill purchasing, Arkonovich saw an opportunity to offer a monthly subscription that unlocks premium features to let customers personalize their experience even further. And the customer response to the subscription has been positive—50% of Big Sky customers opt to purchase the premium experience when offered. In the week after the CNET article recommended Big Sky, Arkonovich’s week-over-week subscriptions jumped by 486%.</p> <p>“The success I’ve had so far in offering my customers premium features and content via in-skill purchasing has renewed my motivation to make the very best product I can,” says Arkonovich. “I can now see myself turning my passion for building Alexa skills into a real business.”</p> <h2>Premium Content Makes a Popular Skill Even Better Through Personalization</h2> <p>Arkonovich first created Big Sky because he didn’t want to listen to an entire weather report just to hear a specific bit of information. His idea was to let each customer decide whether they want to hear a detailed report or just the current temperature, humidity, chance of precipitation, and so on. He also allows the customer to personalize their default location, report type (detailed or basic), units of measure, and more, which further customizes their weather experience to their own taste.</p> <p>“What makes the skill so engaging is that the customer doesn’t get a one-size-fits-all canned response every time they use it,” says Arkonovich. “They’re in the driver’s seat and can choose exactly which information they hear, making the experience very personal.”</p> <p>This high level of personalization led to Big Sky becoming one of the most popular weather skills in the Alexa Skills Store—and significant payouts from the <a href="https://developer.amazon.com/alexa-skills-kit/rewards">Alexa Developer Rewards program</a>, which rewards developers based on their skill engagement.</p> <p>“When Big Sky started bringing in developer rewards, I began thinking of starting a voice business of my own,” says Arkonovich. “But in-skill purchasing puts more control in my own hands to create a very predictable, sustainable income.”</p> <p>Big Sky’s popular features inspired Arkonovich to offer additional personalization as a premium experience via an in-skill purchase. With the basic experience, the user can get a weather report for their default location. Customers opting to purchase the monthly subscription can set up additional addresses, each with its own nickname, such as “Mom’s House” or “The Beach.” That way, customers can ask Alexa for weather information at their favorite locations, without having to spell out the whole address.</p> <p>The subscription also unlocks a number of other premium features, including customized weather alerts. Severe weather alerts are available in the basic experience, but subscribers can enable five different kinds of weather alerts and set the time of day they want to hear each one. And Arkonovich is planning to add new features, like radar imagery, to the subscription regularly.</p> <p>Arkonovich reports that customer feedback on the new premium features has been positive, pointing out that 70% of Big Sky reviewers in the Alexa Skills Store awarded the skill five stars.</p> <p>“Personalizing the experience was always key to Big Sky’s success,” says Arkonovich. “Unlocking even more personalized content via the premium purchase adds substantial value to the skill, and customers are more than happy to buy it.”</p> <h2>Making the Right Offer to the Right Customer at the Right Time</h2> <p>Arkonovich says that getting customers to purchase your in-skill product requires delivering the right upsell message at the right time.</p> <p>“The strength of voice is that it is a very personal experience,” says Arkonovich. “Just as personalizing the experience to each user sets your skill apart from the rest, tailoring your upsell message and its timing to what your customer is looking for at that very moment is key to higher conversion rates.”</p> <p>For example, Arkonovich makes customers aware of his premium features right from the beginning. To enable Big Sky, customers complete account linking in the Alexa app, which is where they also set up their personal preferences. Alongside the standard user preferences, Arkonovich describes the benefits of the premium features and invites customers to enjoy a free seven-day trial. In preparation for the trial, customers are encouraged to enter the nicknames and addresses of one or more “favorite places” to be used in the premium experience.</p> <p>Customers receive different upsell messages at different times, based on their engagement with the skill. For example, entering “favorite places” during setup indicates an interest in the premium features from the beginning. When the customer next invokes the skill, Alexa immediately describes the free trial, subscription period, cost, and cancellation terms, and then asks customers if they want to sign up. For customers who haven’t entered their “favorite places,” Alexa waits until after they’ve used Big Sky a while before offering the premium version. By presenting the right offer message at just the right time, Arkonovich reports that 50% of people who are offered convert to premium subscribers.</p> <h2>In-Skill Purchasing Expands the Possibilities for Developers</h2> <p>For now, Arkonovich is focused on making Big Sky the best weather skill he can and continuing to innovate his premium content and offers, knowing that he is now building a sustainable voice business.</p> <p>“The Alexa team is always innovating to help developers build great experiences and their voice business,” says Arkonovich. “Building Alexa skills may take up a lot of my free time, but it’s something that I really enjoy doing. With capabilities like in-skill purchasing, I’m excited to see just how far I can take my voice business.”</p> <h2>Related Content</h2> <ul> <li><a href="https://developer.amazon.com/alexa-skills-kit/make-money/in-skill-purchasing">Sell Premium Content to Enrich Your Skill Experience</a></li> <li><a href="https://developer.amazon.com/alexa-skills-kit/rewards">Earn Money with Alexa Developer Rewards</a></li> <li><a href="https://build.amazonalexadev.com/alexa-skill-monetization-guide-ww.html">Guide: Make Money with Alexa Skills</a></li> <li><a href="https://developer.amazon.com/blogs/alexa/post/156b211e-355f-4bc8-b1dc-fde19d9acaad/in-skill-purchasing-takes-volley-s-thriving-voice-business-to-the-next-level">In-Skill Purchasing Takes Volley’s Thriving Voice Business to the Next Level</a></li> <li><a href="https://developer.amazon.com/blogs/alexa/post/7da88ba2-8091-460b-a034-a2d3257c0106/with-in-skill-purchasing-gal-shenar-sets-his-growing-voice-business-up-for-long-term-success">With In-Skill Purchasing, Gal Shenar Sets His Growing Voice Business Up for Long-Term Success</a></li> </ul> <h2>Make Money by Creating Engaging Skills Customers Love</h2> <p>You can make money for eligible skills that drive some of the highest customer engagement with <a href="https://developer.amazon.com/alexa-skills-kit/rewards">Alexa Developer Rewards</a>. You can also make money with Alexa skills using <a href="https://developer.amazon.com/alexa-skills-kit/make-money/in-skill-purchasing">in-skill purchasing</a> or <a href="https://developer.amazon.com/alexa-skills-kit/make-money/amazon-pay">Amazon Pay for Alexa Skills</a>. <a href="https://build.amazonalexadev.com/alexa-skill-monetization-guide-ww.html?&amp;sc_category=Owned&amp;sc_channel=WB&amp;sc_campaign=wb_acquisition&amp;sc_publisher=ASK&amp;sc_content=Content&amp;sc_detail=vod-webinar&amp;sc_funnel=Convert&amp;sc_country=WW&amp;sc_medium=Owned_WB_wb_acquisition_ASK_Content_vod-webinar_Convert_WW_visitors_makemoney-page_CTA-graphic&amp;sc_segment=visitors&amp;sc_place=makemoney-page&amp;sc_trackingcode=CTA-graphic" target="_blank">Download our introductory guide</a> to learn more.</p> /blogs/alexa/post/2af6851b-0216-4e82-9aba-6fa2aec755d5/how-to-get-started-with-the-new-alexa-presentation-language-to-build-multimodal-alexa-skills How to Get Started with the Alexa Presentation Language to Build Multimodal Alexa Skills Jennifer King 2018-11-09T17:09:10+00:00 2018-11-09T17:09:10+00:00 <p><img alt="" src="https://m.media-amazon.com/images/G/01/DeveloperBlogs/AlexaBlogs/AlexaSkillsKit/1blog.png._CB480627403_.png" style="height:240px; width:954px" /></p> <p>Learn how to use the Alexa Presentation Language (APL), Amazon’s new voice-first design language, to create rich, interactive displays for Alexa skills and tailor the experience for tens of millions of Alexa-enabled devices.</p> <p><img alt="" src="https://m.media-amazon.com/images/G/01/DeveloperBlogs/AlexaBlogs/AlexaSkillsKit/1blog.png._CB480627403_.png" /></p> <p>Voice is the most natural form of interaction. But in a voice-first world, visuals can enhance interactions with Alexa-enabled devices. By combining visual elements with voice experiences, developers can expand the possibilities of what their skills can do. Alexa-enabled devices have varying display sizes and shapes, purposes, and hardware limitations. For example, while using a skill on an Echo Spot or Fire TV may have similar spoken interactions for a customer, interactivity and information rendered on the screen may vary drastically depending on the device features.</p> <p>The <a href="https://developer.amazon.com/blogs/alexa/post/1dee3fa0-8c5f-4179-ab7a-74545ead24ce/introducing-the-alexa-presentation-language-preview">Alexa Presentation Language (APL)</a> is Amazon’s new voice-first design language you can use to create rich, interactive displays for Alexa skills and tailor the experience for tens of millions of Alexa-enabled devices. Using APL, you can easily build customized, robust displays that coincide with your personal brand and the context of your voice experience.</p> <p>Building voice user interfaces with APL borrows concepts you find in traditional web development, specifically with regards to styling, component nesting, and document hierarchy, but it also maintains security, scalability, and renderability across all Alexa-enabled devices.</p> <p>In this blog post, we will dive into the technical details behind the new design language and explain how to build voice-first, visual experiences with APL.</p> <h2>What Is the Alexa Presentation Language?</h2> <p>APL is, very simply, JSON that is compiled into a visual experience. It is comprised of conditional layouts based upon both user and system-defined variables, and incorporates information from your skill code using data binding.</p> <p>Your graphical user interface is defined by an APL document. When the speech response is sent to a user, a developer can optionally include an APL document to send to the device with a collection of data relevant to that document. The document may also include import packages of existing APL content, including common resource properties, component styles, or pre-defined layouts to be used throughout your document.</p> <p>Below is a RenderDocument directive you would add in your response builder in your skill code to display the APL document. In this case, the APL document is empty, and would thus show a blank display.</p> <pre> <code class="language-javascript">{ &quot;type&quot;: &quot;Alexa.Presentation.APL.RenderDocument&quot;, &quot;datasources&quot;: {}, &quot;document&quot;: { &quot;type&quot;: &quot;APL&quot;, &quot;version&quot;: &quot;1.0&quot;, &quot;import&quot;: [], &quot;resources&quot;: [], &quot;styles&quot;: {}, &quot;layouts&quot;: {}, &quot;mainTemplate&quot;: {} } }</code></pre> <h2>How to Enable APL in Your Skill</h2> <p>To allow an APL document to be a part of your skill’s response, you need to enable the Alexa Presentation interface in the Alexa Developer Console. Navigate to your skill and scroll to interfaces. Once there, toggle “Alexa Presentation Language,” save and build your skill. This will enable the ability to render APL in your skill and automatically add all of the required intents to your interaction model.</p> <p><img alt="" src="https://m.media-amazon.com/images/G/01/DeveloperBlogs/AlexaBlogs/default/APL_image_1.PNG._CB479717482_.png" style="display:block; height:249px; margin-left:auto; margin-right:auto; width:800px" /></p> <p>If you are working outside of the developer console, you can do this in your skill.json. When you create a skill that will incorporate visuals built with APL, you need to assure that you first include ALEXA_PRESENTATION_APL under apis.custom.interfaces in your skill manifest.</p> <pre> <code class="language-javascript">&quot;apis&quot;: { &quot;custom&quot;: { &quot;endpoint&quot;: { &quot;sourceDir&quot;: &quot;lambda/custom&quot; }, &quot;interfaces&quot;: [ { &quot;type&quot;: &quot;ALEXA_PRESENTATION_APL&quot; } ] } },</code></pre> <p>It is important to note that we recently updated all skills to include the built-in intent <a href="https://developer.amazon.com/docs/custom-skills/standard-built-in-intents.html">AMAZON.NavigateHomeIntent</a>. With this update, skills will now handle requests like “go home,” “return to the home screen,” “return home,” and so on. While these commands will mostly benefit multimodal skills, they are also supported on Echo devices without displays. The AMAZON.NavigateHomeIntent exits the skill and returns customers to the Home screen. &nbsp;For skills that have utterances that overlap with AMAZON.NavigateHomeIntent, the overlapping utterances will continue to invoke your custom intent. Either way, no action is needed by you.</p> <h2>How to Build an APL Document</h2> <p>Each entity within the main APL template is called a Component. The current list of primitive components can be found in the <a href="https://developer.amazon.com/docs/alexa-presentation-language/apl-reference.html">APL Reference</a>. The mainTemplate is comprised of components containing text, graphical images, scrolling regions, and several types of layout components that position child components.</p> <p>To customize your APL document, there is a new <a href="https://developer.amazon.com/alexa/console/ask/displays">APL authoring tool</a> available in the developer console. We provide seven samples built entirely in APL that are based upon the <a href="https://developer.amazon.com/docs/custom-skills/display-template-reference.html">Body and List display directive templates</a>. You can choose to build off of any of these APL documents, start your own from scratch, or upload existing APL code.</p> <p><img alt="" src="https://m.media-amazon.com/images/G/01/DeveloperBlogs/AlexaBlogs/default/APL_image_2.png._CB479717477_.png" style="display:block; height:355px; margin-left:auto; margin-right:auto; width:800px" /></p> <h2>How to Incorporate an APL Document into a Response Using the ASK SDK</h2> <p>In your skill code, navigate to the intent to which you’d like to incorporate your visuals. These visuals are sent via an Alexa.Presentation.APL.RenderDocumentdirective. In the Alexa Skills Kit (ASK) Software Development Kit (SDK) for Node.js, you can add this in your response builder.</p> <pre> <code class="language-javascript">return handlerInput.responseBuilder .speak(speechResponse) .reprompt(repromptResponse) .addDirective({ type : 'Alexa.Presentation.APL.RenderDocument', document : document, datasources : data }) .getResponse();</code></pre> <h2>Start Learning with 3 New APL Skill Samples and More</h2> <p>To help you get started, we’ve created three new sample skills using APL: <a href="https://github.com/alexa-labs/skill-sample-nodejs-level-up-riddles" target="_blank">Level Up Riddles</a>, <a href="https://github.com/alexa-labs/skill-sample-nodejs-movie-quotes-quiz" target="_blank">Movie Quote Quiz</a>, and <a href="https://github.com/alexa-labs/skill-sample-nodejs-pager-karaoke" target="_blank">Pager Karaoke</a>. We plan on building upon these skills in the future to incorporate more APL features. We have also updated <a href="https://github.com/alexa/skill-sample-nodejs-petmatch/tree/petmatch-with-apl" target="_blank">Pet Match</a> to include a branch with a version of the skill that includes APL.</p> <p>Visit our <a href="https://developer.amazon.com/alexa-skills-kit/multimodal#See%20What%20Others%20Have%20Built%20with%20APL">website</a> to see how others are using APL to create engaging multimodal skills and get inspired to start building your own voice-first, visual experiences. To get started with APL, check out our <a href="https://developer.amazon.com/docs/alexa-presentation-language/apl-overview.html?&amp;sc_category=Owned&amp;sc_channel=WB&amp;sc_campaign=APLpublicbeta&amp;sc_publisher=blogannouncement&amp;sc_content=Content&amp;sc_funnel=Discover&amp;sc_country=WW&amp;sc_medium=Owned_WB_APLpublicbeta_blogannouncement_Content_Discover_WW_all&amp;sc_segment=all">technical documentation</a> and the <a href="https://developer.amazon.com/docs/alexa-design/intro.html?&amp;sc_category=Owned&amp;sc_channel=WB&amp;sc_campaign=APLpublicbeta&amp;sc_publisher=blogannoucnement&amp;sc_content=Content&amp;sc_funnel=Discover&amp;sc_country=WW&amp;sc_medium=Owned_WB_APLpublicbeta_blogannoucnement_Content_Discover_WW_all&amp;sc_segment=all">Alexa Design Guide.</a></p> <h2>Register for an APL Webinar</h2> <p>Watch our <a href="https://build.amazonalexadev.com/get-started-with-the-apl-on-demand-registration-ww.html" target="_blank">on-demand webinar on how to get started with APL</a>. We cover how to use the new APL authoring tool, how to incorporate a template into your skill, and best practices for building multimodal skills. To dive deeper into APL, register for our next webinar on <a href="https://build.amazonalexadev.com/layouts-styling-best-practices-ww.html?&amp;sc_category=Owned&amp;sc_channel=VLE&amp;sc_campaign=APLpublicbeta&amp;sc_publisher=webinar2&amp;sc_content=Content&amp;sc_funnel=Discover&amp;sc_country=WW&amp;sc_medium=Owned_VLE_APLpublicbeta_webinar2_Content_Discover_WW_all&amp;sc_segment=all" target="_blank">Advanced Template Building with the Alexa Presentation Language</a> to learn about template styling and layout best practices.</p> <p>We can’t wait to see what you build!</p> <h2>Related Content</h2> <ul> <li><a href="https://developer.amazon.com/blogs/alexa/post/1dee3fa0-8c5f-4179-ab7a-74545ead24ce/introducing-the-alexa-presentation-language-preview">Introducing the Alexa Presentation Language (Preview)</a></li> <li><a href="https://developer.amazon.com/blogs/alexa/post/0d2ad283-b7c3-48ba-8313-40f2b5fdc19d/alexa-presentation-language-now-available">Now Available: Alexa Presentation Language (Public Beta) for Multimodal Experiences</a> <a href="https://developer.amazon.com/blogs/alexa/post/7861710b-fcab-4a5c-917a-265854c3b30c/how-voice-and-graphics-working-together-enhance-the-alexa-experience">How Voice and Graphics Working Together Enhance the Alexa Experience</a></li> </ul> <p>&nbsp;</p> /blogs/alexa/post/af4b0637-c473-4768-bdf5-cc2b56eec0d1/now-available-test-multi-turn-conversations-beta-using-the-ask-cli-and-smapi Now Available: Test Multi-Turn Conversations (Beta) Using the ASK CLI and SMAPI BJ Haberkorn 2018-11-08T20:05:30+00:00 2018-11-09T20:55:05+00:00 <p><img src="https://m.media-amazon.com/images/G/01/DeveloperBlogs/AlexaBlogs/default/SMAPI_blog_(1)(1)._CB517727736_.png" /></p> <p>Now you can now test multi-turn conversations) using the new dialog command (beta) in the ASK CLI and the updated simulation API (beta) in SMAPI.</p> <p>&nbsp;</p> <p><img src="https://m.media-amazon.com/images/G/01/DeveloperBlogs/AlexaBlogs/default/SMAPI_blog_(1)(1)._CB517727736_.png" /></p> <p>We’re excited to announce that Alexa developers worldwide can now test multi-turn conversations using the new dialog command (beta) in the Alexa Skills Kit (ASK) Command Line Interface (CLI) and the updated simulation API (beta) in the Skill Management API (SMAPI). Previously, you could only simulate multi-turn conversations using the Alexa Developer Console. If you use the CLI, SMAPI, or the ASK plugin for Visual Studio Code for skill development, you can use this new testing capability to improve your skill conversations and deliver a better experience to your customers.</p> <h2>Simulate a Conversation on the Command Line</h2> <p>Using the new dialog command in the CLI, you can simulate a conversation with your skill on the command line. As shown below, the simulation supports multi-turn conversations. You can test multiple paths through your skill, and vary your responses to confirm how your skill will respond.</p> <p><img alt="" src=" https://m.media-amazon.com/images/G/01/DeveloperBlogs/AlexaBlogs/AlexaSkillsKit/DialogCLI.png._CB481222856_.png" style="display:block; margin-left:auto; margin-right:auto" /></p> <h2>Capture Utterances and Skill Responses for Debugging and to Streamline Future Testing</h2> <p>The output option of the dialog command captures all utterances, skill responses, and the associated JSON elements to a file. You can use the information in these output files to help you debug your backend service logic. At any time during a session, you can use the record command to capture your text utterances since the start of the session or your last recording point to a file. You can use the recorded files to automate the execution of frequently used tests. Simply record the sets of utterances needed to test your skill, and play these conversations back in the future using the replay function.</p> <h2>Use the Development Option That Works Best for You</h2> <p>The <a href="https://developer.amazon.com/docs/smapi/ask-cli-command-reference.html#dialog-command">dialog command in the CLI</a> takes advantage of updates to the <a href="https://developer.amazon.com/docs/smapi/skill-simulation-api.html">simulation API</a> in SMAPI, and is available in the <a href="https://marketplace.visualstudio.com/items?itemName=ask-toolkit.alexa-skills-kit-toolkit">ASK Toolkit for Visual Studio Code</a>. Now, you can test multi-turn conversations regardless of which development tool you prefer.</p> <p>&nbsp;</p> /blogs/alexa/post/efd1fd50-84fe-4e48-97e2-a61ad0612bc3/building-conversational-alexa-skills-confirming-slots-with-dialog-management Building Conversational Alexa Skills: Confirming Slots with Dialog Management Jennifer King 2018-11-08T15:00:00+00:00 2018-11-09T16:14:42+00:00 <p>In this technical post, I build upon the coffee shop skill that I introduced in the blog about how to dynamically elicit slots based on a previous answer using dialog management.</p> <p>I've spent a lot of time deep diving into <a href="https://developer.amazon.com/alexa-skills-kit/dialog-management">dialog management</a>. It is a great tool for building complex multi-turn conversational skills. As I continue to share my learnings with the community, I'm often asked about eliciting slot confirmations.</p> <p><a href="https://developer.amazon.com/alexa-skills-kit/dialog-management">Dialog management</a> simplifies creating a multi-turn conversational skill. When you set at least one of your slots <strong>required to fulfull the intent</strong>, the Alexa voice service will keep track of the dialog state and the required slots that have yet to be collected and send this information to your back end. At each turn, your skill can return a <strong>dialog</strong> directive to determine what Alexa will do. Returning a <strong>Dialog.Delegate</strong> directive will have the Alexa voice service automatically prompt for the next slot. Returning the <strong>Dialog.ElicitSlot</strong> directive will allow you to determine what slot Alexa will prompt next. Returning the <strong>Dialog.ConfirmSlot</strong> directive will allow you ask your customer to confirm a slot value.</p> <p>In this technical post, I build upon the coffee shop skill that I introduced in the blog about <a href="https://developer.amazon.com/blogs/alexa/post/dbceb5dd-3c4d-40f1-be22-172f4050fbcb/building-conversational-alexa-skills-how-to-dynamically-elicit-slots-based-on-a-previous-answer-using-dialog-management">how to dynamically elicit slots based on a previous answer using dialog management</a>.</p> <h2>Recap: The Coffee Shop Skill</h2> <p>Our coffee shop skill allows the customer to order <strong>coffee</strong> or <strong>tea</strong>. Based on their <strong>drink</strong> of choice, the skill either asks what kind of coffee roast (<strong>coffeeRoast</strong>) or type of tea (<strong>teaType</strong>) they want. In my previous post, I walked through the steps to dynamically elicit the <strong>coffeeRoast</strong> and <strong>teaType</strong> slots based upon the <strong>drink</strong> using the <strong>Dialog.ElicitSlot</strong> directive.</p> <h2>Enhancing the Coffee Shop Skill</h2> <p>Let's say we want to add the ability to add some flavor to our coffee. Our coffee shop charges an extra $0.50 to add a <strong>flavor</strong>, so we'll use the <strong>Dialog.ConfirmSlot</strong> directive to ask if the customer is willing to except the additional charges. First, we only want to upsell the <strong>flavor</strong> when <strong>drink</strong> is <strong>coffee</strong>, so we will use <strong>Dialog.ElicitSlot</strong> to dynamically elicit our new <strong>flavor</strong>. Second, we will confirm the slot with <strong>Dialog.ConfirmSlot</strong>, but what if our customer doesn't want to add any <strong>flavor</strong> from the start? We'll add &quot;no thanks&quot; as one of our <strong>flavor</strong> slot values and we will only return the <strong>Dialog.ConfirmSlot</strong> directive when the customer chooses a <strong>flavors</strong>.</p> <p>The two steps will be:</p> <ol> <li>Dynamically elicit <strong>flavor</strong> when <strong>drink</strong> is <strong>coffee</strong> with <strong>Dialog.ElicitSlot</strong></li> <li>Confirm the $0.50 upsell if a <strong>flavor</strong> is given with <strong>Dialog.ConfirmSlot</strong></li> </ol> <p>Last, we will need to handle what to do next based on if the customer <strong>confirms</strong> or <strong>denies</strong> the extra cost for adding a <strong>flavor</strong>.</p> <p>Follow along as I walk you through the process.</p> <h2>Updating the Voice Model</h2> <p>We'll start by updating our voice model. At this point, our coffee shop skill has three custom slots, <strong>drink</strong>, <strong>coffeeRoast,</strong> and <strong>teaType.</strong> The values are:</p> <table cellspacing="0" style="height:273px; width:445px"> <tbody> <tr> <td> <p><strong>drink</strong></p> </td> <td> <p><strong>coffeRoast</strong></p> </td> <td> <p><strong>teaType</strong></p> </td> </tr> <tr> <td> <p>coffe</p> </td> <td> <p>light</p> </td> <td> <p>black</p> </td> </tr> <tr> <td> <p>tea</p> </td> <td> <p>medium</p> </td> <td> <p>green</p> </td> </tr> <tr> <td> <p>&nbsp;</p> </td> <td> <p>medium dark</p> </td> <td> <p>white</p> </td> </tr> <tr> <td> <p>&nbsp;</p> </td> <td> <p>dark</p> </td> <td> <p>oolong</p> </td> </tr> </tbody> </table> <p>When interacting with our skill, a customer may say one of the the following utterances to tell us their order.</p> <p><code>Start my order<br /> I'll have {drink}<br /> I want to drink {drink}<br /> I want {coffeeRoast} {drink}<br /> I want {drink} to drink<br /> I want {teaType} {drink}<br /> {teaType} {drink} sounds great<br /> {drink} please</code></p> <p>To enable our customer to be able specify their desired flavor we'll need to update our utterances and create a new custom slot. For example, they may say something like:</p> <p><code>I want a medium roast coffee with a shot of vanilla<br /> I want to drink coffee with hazelnut<br /> I want a shot of caramel in my coffee<br /> Coffee with vanilla</code></p> <p>These utterances will use our new slot which we'll call <strong>flavor</strong>. Using our <strong>drink</strong>, <strong>coffeeRoast</strong> and <strong>flavor</strong> slots we will replace the values we want to capture with our slots.</p> <p><code>I want a {coffeeRoast} {drink} with a shot of {flavor}<br /> I want to drink {drink} with {flavor}<br /> I want a shot of {flavor} in my {drink}<br /> {drink} with {flavor}</code></p> <p>The table below shows our flavor slot's custom values.</p> <table border="1" cellpadding="1" cellspacing="1" style="height:119px; width:157px"> <tbody> <tr> <td><strong>flavors</strong></td> </tr> <tr> <td>no thanks</td> </tr> <tr> <td>vanilla</td> </tr> <tr> <td>hazelnut</td> </tr> <tr> <td>caramel</td> </tr> </tbody> </table> <p>The <strong>no thanks</strong> value will allow our customer to decline a <strong>flavor</strong> add-on which we will prompt for using the <strong>Dialog.ElicitSlot</strong> directive if their <strong>drink</strong> is <strong>coffee</strong>. If any other value is given, we will ask if it's ok to charge $0.50 extra to add a flavor.</p> <p>Now that we understand how our voice user interaction model will change. Let's take a look at our back-end code.</p> <h2>Eliciting and Confirming Slots From Our Back End</h2> <p>Similar to our <strong>coffeeRoast</strong> and <strong>teaType</strong> slots, our <strong>flavor</strong> slot is dynamic. We will only ask our customers if they want to add flavors if their <strong>drink</strong> is <strong>coffee</strong>. So we will be using <strong>Dialog.ElicitSlot</strong> to elicit the <strong>flavor</strong> slot and <strong>Dialog.SlotConfirmation</strong> to elicit a confirmation. To acheive this we'll define two more handlers. These handlers will represent the various situations of our skill and we will use them to <em>elicit</em> and <em>confirm</em> the <strong>flavor</strong> slot. Our handlers are:</p> <ul> <li>CoffeeRoastGivenPromptFlavorOrderIntentHandler</li> <li>FlavorGivenConfirmSlotOrderIntentHandler</li> </ul> <h3>CoffeeRoastGivenPromptFlavorOrderIntentHandler</h3> <p>This handler will use the <strong>Dialog.ElicitSlot</strong> directive to dynamically elicit the <strong>flavor</strong> slot. The <strong>canHandle</strong> function will return <strong>true</strong> if:</p> <ul> <li>request.type <strong>equals</strong> IntentRequest</li> <li>request.intent.name <strong>equals</strong> OrderIntent</li> <li>request.intent.slots.drink.value <strong>is not empty</strong></li> <li>request.intent.slots.drink.value <strong>equals</strong> coffee</li> <li>request.intent.slots.coffeeRoast.value <strong>is not empty</strong></li> <li>request.intent.slots.flavor.value <strong>is not empty</strong></li> </ul> <p>For example, this will occur if the user says, &quot;I want dark coffee.&quot;</p> <pre> <code class="language-javascript">canHandle(handlerInput) { return handlerInput.requestEnvelope.request.type === &quot;IntentRequest&quot; &amp;&amp; handlerInput.requestEnvelope.request.intent.name === &quot;OrderIntent&quot; &amp;&amp; handlerInput.requestEnvelope.request.intent.slots.drink.value &amp;&amp; handlerInput.requestEnvelope.request.intent.slots.drink.value === &quot;coffee&quot; &amp;&amp; handlerInput.requestEnvelope.request.intent.slots.coffeeRoast.value &amp;&amp; handlerInput.requestEnvelope.request.intent.slots.flavor.value &amp;&amp; handlerInput.requestEnvelope.request.intent.slots.flavor.value !== &quot;no thanks&quot; &amp;&amp; handlerInput.requestEnvelope.request.intent.slots.flavor.confirmationStatus === &quot;NONE&quot;; },</code></pre> <p>The handler will then use the <strong>Dialog.ElicitSlot</strong> directive to elicit the <strong>flavor</strong> slot.</p> <pre> <code class="language-javascript">handle(handlerInput) { return handlerInput.responseBuilder .speak(&quot;I can add some flavor to your coffee. Which would you like, caramel, hazelnut, or vanilla? You can also say no thanks.&quot;) .reprompt(&quot;What flavor would you like added to your coffee, caramel, hazelnut, or vanilla? You can also say no thanks.&quot;) .addElicitSlotDirective(&quot;flavor&quot;) .getResponse(); }</code></pre> <p>Below is the the whole handler at a glance:</p> <pre> <code class="language-javascript">const CoffeeRoastGivenPromptFlavorOrderIntentHandler = { canHandle(handlerInput) { return handlerInput.requestEnvelope.request.type === &quot;IntentRequest&quot; &amp;&amp; handlerInput.requestEnvelope.request.intent.name === &quot;OrderIntent&quot; &amp;&amp; handlerInput.requestEnvelope.request.intent.slots.drink.value &amp;&amp; handlerInput.requestEnvelope.request.intent.slots.drink.value === &quot;coffee&quot; &amp;&amp; handlerInput.requestEnvelope.request.intent.slots.coffeeRoast.value &amp;&amp; !handlerInput.requestEnvelope.request.intent.slots.flavor.value; }, handle(handlerInput) { return handlerInput.responseBuilder .speak(&quot;I can add some flavor to your coffee. Which would you like, caramel, hazelnut, or vanilla? You can also say no thanks.&quot;) .reprompt(&quot;What flavor would you like added to your coffee, caramel, hazelnut, or vanilla? You can also say no thanks.&quot;) .addElicitSlotDirective(&quot;flavor&quot;) .getResponse(); } };</code></pre> <p>Now that we're able to dynamically elicit the <strong>flavor</strong> slot if the order <strong>coffee</strong>, we will move to the next handler.</p> <h3>FlavorGivenConfirmSlotOrderIntentHandler</h3> <p>Our <strong>FlavorGivenConfirmSlotOrderIntentHandler</strong> will use the <strong>Dialog.ConfirmSlot</strong> directive. Its <strong>canHandle</strong> function will return <strong>true</strong> if:</p> <ul> <li>request.type <strong>equals</strong> IntentRequest</li> <li>request.intent.name <strong>equals</strong> OrderIntent</li> <li>request.intent.slots.drink.value <strong>is not empty</strong></li> <li>request.intent.slots.drink.value <strong>equals</strong> coffee</li> <li>request.intent.slots.coffeeRoast.value <strong>is not empty</strong></li> <li>request.intent.slots.flavor.value <strong>is not empty</strong></li> <li>request.intent.slots.flavor.value <strong>is not equal to</strong> no thanks</li> <li>request.intent.slots.flavor.confirmationStatus <strong>equals</strong> NONE</li> </ul> <p>The last condition, <strong>request.intent.slots.flavor.confirmationStatus equals NONE</strong>, is super important. Without it the skill will continuously pester our customer to confirm the <strong>flavor</strong> slot. Before a slot has been confirmed the <strong>confirmationStatus</strong> is <strong>NONE</strong>. Once the customer provides an answer it will be either <strong>DENIED</strong> or <strong>CONFIRMED</strong>, so before we confirm the <strong>flavor</strong> slot, we should check the <strong>confirmationStatus</strong>.</p> <pre> <code class="language-javascript">canHandle(handlerInput) { return handlerInput.requestEnvelope.request.type === &quot;IntentRequest&quot; &amp;&amp; handlerInput.requestEnvelope.request.intent.name === &quot;OrderIntent&quot; &amp;&amp; handlerInput.requestEnvelope.request.intent.slots.drink.value &amp;&amp; handlerInput.requestEnvelope.request.intent.slots.drink.value === &quot;coffee&quot; &amp;&amp; handlerInput.requestEnvelope.request.intent.slots.coffeeRoast.value &amp;&amp; handlerInput.requestEnvelope.request.intent.slots.flavor.value &amp;&amp; handlerInput.requestEnvelope.request.intent.slots.flavor.value !== &quot;no thanks&quot; &amp;&amp; handlerInput.requestEnvelope.request.intent.slots.flavor.confirmationStatus === &quot;NONE&quot;; },</code></pre> <p>Our <strong>handle</strong> function builds the confirmation prompt and returns the <strong>Dialog.ConfirmSlot</strong> directive.</p> <pre> <code class="language-javascript">handle(handlerInput) { const flavor = handlerInput.requestEnvelope.request.intent.slots.flavor.value; const speechText = `Adding ${flavor} will cost $0.50 extra. Would you like me to add it?`; return handlerInput.responseBuilder .speak(speechText) .reprompt(speechText) .addConfirmSlotDirective(&quot;flavor&quot;) .getResponse(); }</code></pre> <p>Zooming out you can see how the handler's <strong>canHandle</strong> and <strong>handle</strong> functions fit together:</p> <pre> <code class="language-javascript">const FlavorGivenConfirmSlotOrderIntentHandler = { canHandle(handlerInput) { return handlerInput.requestEnvelope.request.type === &quot;IntentRequest&quot; &amp;&amp; handlerInput.requestEnvelope.request.intent.name === &quot;OrderIntent&quot; &amp;&amp; handlerInput.requestEnvelope.request.intent.slots.drink.value &amp;&amp; handlerInput.requestEnvelope.request.intent.slots.drink.value === &quot;coffee&quot; &amp;&amp; handlerInput.requestEnvelope.request.intent.slots.coffeeRoast.value &amp;&amp; handlerInput.requestEnvelope.request.intent.slots.flavor.value &amp;&amp; handlerInput.requestEnvelope.request.intent.slots.flavor.value !== &quot;no thanks&quot; &amp;&amp; handlerInput.requestEnvelope.request.intent.slots.flavor.confirmationStatus === &quot;NONE&quot;; }, handle(handlerInput) { const flavor = handlerInput.requestEnvelope.request.intent.slots.flavor.value; const speechText = `Adding ${flavor} will cost $0.50 extra. Would you like me to add it?`; return handlerInput.responseBuilder .speak(speechText) .reprompt(speechText) .addConfirmSlotDirective(&quot;flavor&quot;) .getResponse(); } };</code></pre> <p>Once the slot has been either confirmed or denied it's up to you to determine what to do next. Since we don't need to collect anymore slots and our <strong>FlavorGivenConfirmSlotOrderIntentHandler</strong> only happens after we've collected all of our <strong>coffee</strong> related slots, we'll handle the aftermath of the confirmation in our <strong>CompletedOrderIntentHandler</strong>.</p> <h3>CompletedOrderIntentHandler</h3> <p>This handler runs after the dialog has completed. The <strong>canHandle</strong> will return <strong>true</strong> if:</p> <ul> <li>request.type <strong>equals</strong> IntentRequest</li> <li>request.intent.name <strong>equals</strong> OrderIntent</li> <li>request.dialogState <strong>equals</strong> COMPLETED</li> </ul> <p>The <strong>canHandle</strong> translates to three simple checks.</p> <pre> <code class="language-javascript">canHandle(handlerInput) { return handlerInput.requestEnvelope.request.type === &quot;IntentRequest&quot; &amp;&amp; handlerInput.requestEnvelope.request.intent.name === &quot;OrderIntent&quot; &amp;&amp; handlerInput.requestEnvelope.request.dialogState === &quot;COMPLETED&quot;; },</code></pre> <p>The <strong>handle</strong> function includes our logic to handle the <strong>confirmationStatus</strong>. If <strong>drink</strong> is <strong>coffee</strong>, our logic checks the <strong>confirmationStatus</strong>. If it's <strong>DENIED</strong> we let our customer know that we've removed the flavor from their order. If it's <strong>CONFIRMED</strong> then we let them know that they made a great choice. At this point our sample skill ends, but if we were building a real coffee shop skill, we would plug our logic to add the item to their shopping cart and ask if they want to, &quot;check out or add another item to their shopping cart?&quot;</p> <pre> <code class="language-javascript">handle(handlerInput) { const slots = handlerInput.requestEnvelope.request.intent.slots; const drink = slots.drink.value; let type = ''; let speechText = &quot;Awesome! &quot;; if (drink === 'coffee') { type = slots.coffeeRoast.value; if(slots.flavor.confirmationStatus === &quot;DENIED&quot;) { speechText = `Ok, I've removed ${slots.flavor.value} from your order. `; } else if (slots.flavor.confirmationStatus === &quot;CONFIRMED&quot;) { speechText = `Yummy. ${slots.flavor.value} is an excellent choice. `; } } else if (drink === 'tea') { type = handlerInput.requestEnvelope.request.intent.slots.teaType.value; } speechText += `I've added ${type} ${drink} to your shopping cart.`; return handlerInput.responseBuilder .speak(speechText) .getResponse(); } </code></pre> <p>You can see what the handler looks like put together below.</p> <pre> <code class="language-javascript">const CompletedOrderIntentHandler = { canHandle(handlerInput) { return handlerInput.requestEnvelope.request.type === &quot;IntentRequest&quot; &amp;&amp; handlerInput.requestEnvelope.request.intent.name === &quot;OrderIntent&quot; &amp;&amp; handlerInput.requestEnvelope.request.dialogState === &quot;COMPLETED&quot;; }, handle(handlerInput) { const slots = handlerInput.requestEnvelope.request.intent.slots; const drink = slots.drink.value; let type; let speechText = &quot;Awesome! &quot;; if (drink === 'coffee') { type = slots.coffeeRoast.value; if(slots.flavor.confirmationStatus === &quot;DENIED&quot;) { speechText = `Ok, I've removed ${slots.flavor.value} from your order. `; } else if (slots.flavor.confirmationStatus === &quot;CONFIRMED&quot;) { speechText = `Yummy. ${slots.flavor.value} is an excellent choice. `; } } else if (drink === 'tea') { type = handlerInput.requestEnvelope.request.intent.slots.teaType.value; } else { type = 'water'; } speechText += `I've added ${type} ${drink} to your shopping cart.`; return handlerInput.responseBuilder .speak(speechText) .getResponse(); } }</code></pre> <p>After all that, you may be asking, what should I do if the customer doesn't provide a valid option for <strong>drink</strong>. What if they say <strong>water</strong> or <strong>baseball</strong>? In my next post I'll demonstrate how you can validate user input. Until then, think about how you would do this. What handlers would you need? How would your re-elicit a slot? What dialog directives would you need?</p> <p>Now that you've read through this post, try to think about how you can put these techniques to use in your own skills. Let's continue the discussion online! You can find me on Twitter. Reach out to me at <a href="https://twitter.com/sleepydeveloper">@SleepyDeveloper</a>.</p> <h2>Related Resources</h2> <ul> <li><a href="https://developer.amazon.com/blogs/alexa/post/dbceb5dd-3c4d-40f1-be22-172f4050fbcb/building-conversational-alexa-skills-how-to-dynamically-elicit-slots-based-on-a-previous-answer-using-dialog-management">Building Conversational Alexa Skills: How to Dynamically Elicit Slots Based on a Previous Answer Using Dialog Management</a></li> <li><a href="https://developer.amazon.com/alexa-skills-kit/dialog-management">Build Advanced Alexa Skills Using Dialog Management</a></li> <li><a href="https://build.amazonalexadev.com/alexa-skill-dialog-management-guide-ww.html">Guide: Advanced Skill Building with Dialog Management</a></li> <li><a href="https://developer.amazon.com/blogs/alexa/post/d1e8b7d5-c93f-490e-a8b0-c8c53506e04e/6-dialog-management-resources-to-build-advanced-alexa-skills">6 Dialog Management Resources to Build Advanced Alexa Skills</a></li> </ul> /blogs/alexa/post/2abdf658-556c-4700-8cbd-ada7bd18dbf5/introducing-the-avs-hosted-splash-screen Introducing the AVS Hosted Splash Screen Sanjay Ramaswamy 2018-11-07T18:57:46+00:00 2018-11-07T18:57:46+00:00 <p><a href="https://developer.amazon.com/blogs/alexa/post/2abdf658-556c-4700-8cbd-ada7bd18dbf5/introducing-the-avs-hosted-splash-screen" target="_self"><img alt="" src="https://m.media-amazon.com/images/G/01/DeveloperBlogs/AlexaBlogs/default/P17315481_hosted_splash_blog_v2_954x240_.png._CB479341220_.png" /></a></p> <p>Introducing&nbsp;the Alexa Voice Service (AVS) Hosted Splash screen to create a better and more consistent Alexa registration experience for devices with Alexa built-in.</p> <p>&nbsp;</p> <p><img alt="Alexa Voice Service Hosted Splash Screen" src="https://m.media-amazon.com/images/G/01/DeveloperBlogs/AlexaBlogs/default/P17315481_hosted_splash_blog_v2_954x240_.png._CB479341220_.png" /></p> <p>Today, the Alexa Voice Service (AVS) is introducing an AVS Hosted Splash screen to create a better and more consistent Alexa registration experience for devices with Alexa built-in. We are introducing the AVS Hosted Splash screen for two reasons: to eliminate the time device makers spend engineering their own webview to host an Alexa splash screen and to help improve customer engagement with Alexa built-in products. Amazon will continuously monitor and regularly improve the AVS Hosted Splash screen, which currently features three content zones optimized for registrations: graphic, copy, and call-to-action. This will also ensure consistency of the Alexa registration experience across all devices.</p> <h2>How to Enable the AVS Hosted Splash Screen</h2> <p>You will need to request the new <em>alexa:voice_service:preauth</em> scope and the <em>alexa:all</em> scope when requesting Login with Amazon (LWA) to register a new customer (and remove your existing splash screen if applicable). The AVS Hosted Splash screen will then be deployed automatically to the device that creates a LWA request in the companion app. See our <a href="https://developer.amazon.com/docs/alexa-voice-service/authorize-companion-app.html" target="_blank">documentation</a> for more details.</p> <p><strong>If you already have a product in market,</strong> you can choose to either keep your existing splash screen or update to the AVS Hosted Splash screen. <strong>If you are developing a new product,</strong> you must use the AVS Hosted Splash screen and you no longer need to build and host your own Alexa splash screen.</p> <h2>New to AVS?</h2> <p>AVS makes it easy to develop products with Alexa built-in and bring voice-forward experiences to your customers. Through AVS, you can add a new natural user interface to your products and offer your customers access to a growing number of Alexa features, smart home integrations, and skills. <a href="https://developer.amazon.com/alexa-voice-service/sdk" target="_blank">Get Started</a>.</p> /blogs/alexa/post/d5614e27-99d2-460b-a295-51f4fde36f89/amazon-presenta-alexa-y-los-dispositivos-echo-echo-dot-echo-plus-y-echo-spot-en-mexico Amazon Introduces Alexa and Echo, Echo Dot, Echo Plus, and Echo Spot in Mexico | Amazon Presenta Alexa y los dispositivos Echo, Echo Dot, Echo Plus y Echo Spot en M&eacute;xico Claudia Gomez Silva 2018-11-07T17:06:58+00:00 2018-11-07T17:06:58+00:00 <p><a href="https://developer.amazon.com/blogs/alexa/post/d5614e27-99d2-460b-a295-51f4fde36f89/amazon-presenta-alexa-y-los-dispositivos-echo-echo-dot-echo-plus-y-echo-spot-en-mexico" target="_self"><img alt="Echo-MX_blog.png" src="https://m.media-amazon.com/images/G/01/DeveloperBlogs/AlexaBlogs/default/Echo-MX_blog.png._CB480799243_.png?t=true" /></a></p> <p style="text-align:justify">Amazon today announced that Alexa, the brain that powers the Echo family of devices, is coming to Mexico, along with Alexa-enabled devices: Amazon Echo, Echo Dot, Echo Plus, and Echo Spot.</p> <p><img alt="Echo-MX_blog.png" src="https://m.media-amazon.com/images/G/01/DeveloperBlogs/AlexaBlogs/default/Echo-MX_blog.png._CB480799243_.png?t=true" /></p> <p>Amazon today announced that Alexa, the brain that powers the Echo family of devices, is coming to Mexico, along with Alexa-enabled devices: Amazon Echo, Echo Dot, Echo Plus, and Echo Spot. Customers can pre-order devices beginning today at <a href="http://www.amazon.com.mx/echo" target="_blank">www.amazon.com.mx/echo</a>. All devices will begin shipping next week.</p> <div> <hr /> <div> <div> <h2>Amazon Presenta Alexa y los dispositivos Echo, Echo Dot, Echo Plus y Echo Spot en M&eacute;xico</h2> <p>Amazon anunci&oacute; que Alexa, el cerebro que impulsa la familia de dispositivos Echo llega a M&eacute;xico, junto con los dispositivos con Alexa integrada: Amazon Echo, Echo Dot, Echo Plus y Echo Spot. Los consumidores pueden comprar en pre-venta los dispositivos hoy mismo en <a href="http://www.amazon.com.mx/echo" target="_blank">www.amazon.com.mx/echo</a>. Asimismo, todos los dispositivos comenzar&aacute;n a enviarse la pr&oacute;xima semana.</p> <h2 style="text-align:justify">Alexa Skills Kit y Alexa Voice Service se expanden a M&eacute;xico</h2> <p style="text-align:justify">Los desarrolladores est&aacute;n utilizando <a href="https://developer.amazon.com/es-mx/alexa-skills-kit/">Alexa Skills Kit</a> (ASK) y <a href="https://developer.amazon.com/es-mx/alexa-voice-service">Alexa Voice Service</a> (AVS) para crear nuevas Skills, as&iacute; como nuevos dispositivos que incorporan Alexa, para los consumidores de M&eacute;xico.</p> <p style="text-align:justify">Cientos de Skills ya est&aacute;n disponibles para los consumidores mexicanos incluidas Skills de Noticieros Televisa, Cin&eacute;polis, Uber, El Universal, Domino’s, Expansi&oacute;n, Aerom&eacute;xico, Mediotiempo, Kiwilim&oacute;n, Cartoon Network, Philips Hue, TP-Link, Las Estrellas, Milenio, Marat&oacute;n entre otras.</p> <p style="text-align:justify">Empresas que crean dispositivos conectados como Sonos, Bose, Harman Kardon, y Jabra estar&aacute;n lanzando dispositivos para los consumidores mexicanos.</p> <h2 style="margin-left:0in; margin-right:0in">A&ntilde;ade Funcionalidades a Alexa Utilizando el Alexa Skills Kit (ASK)</h2> <p style="margin-left:0in; margin-right:0in; text-align:justify">El <a href="https://developer.amazon.com/es-mx/alexa-skills-kit/">Alexa Skills Kit</a> (ASK) es una colecci&oacute;n de herramientas y APIs gratuitas y de auto-servicio que aceleran y facilitan la creaci&oacute;n de Skills de Alexa por parte de los desarrolladores. Con ASK los dise&ntilde;adores, desarrolladores y las marcas pueden construir Skills atractivas y alcanzar a millones de consumidores en EEUU, Reino Unido, Alemania, India, Jap&oacute;n, Canad&aacute;, Australia, Nueva Zelanda, Francia, Italia, Espa&ntilde;a y, a partir de ahora, en M&eacute;xico. Los desarrolladores no necesitan tener conocimientos previos en tecnolog&iacute;as de comprensi&oacute;n de lenguaje natural o reconocimiento del habla para construir una Skill de Alexa. Desde noticias diarias y juegos interactivos hasta integraciones en el hogar digital, los desarrolladores de M&eacute;xico y de todo el mundo est&aacute;n creando experiencias enfocadas en la voz con Alexa.</p> <h2>Obt&eacute;n Ayuda T&eacute;cnica del Equipo Alexa</h2> <p style="text-align:justify">Invitamos a los desarrolladores a unirse al equipo de Alexa en diversos eventos presenciales como nuestros workshops mensuales y Alexa Dev Days, as&iacute; como a participar en nuestros eventos online como webinars mensuales y sesiones semanales en vivo con nuestros Evangelistas T&eacute;cnicos (&quot;Pregunta al experto&quot;) para aprender c&oacute;mo crear una Skill de Alexa. Los desarrolladores pueden registrarse a los diferentes eventos <a href="https://developer.amazon.com/es-mx/alexa-skills-kit/" target="_blank">aqu&iacute;</a>.</p> <ul> <li style="text-align:justify">[Seminario web] “Desarrolla tu primera experiencia de voz en espa&ntilde;ol con Amazon Alexa”- <a href="https://build.amazonalexadev.com/2018Nov23_Build_First_Skill_Registration.html" target="_blank">23 de noviembre de 2018</a></li> <li style="text-align:justify">[Seminario web] Las claves para certificar con &eacute;xito tu Skill de Alexa- <a href="https://build.amazonalexadev.com/2018Dec07_Keys_Certification_Registration.html" target="_blank">7 de diciembre de 2018</a></li> <li style="text-align:justify">[Evento] Alexa Skills Workshop Ciudad de M&eacute;xico - <a href="https://mxalexaskillsworkshop1214.splashthat.com/" target="_blank">14 de diciembre de 2018</a></li> <li style="text-align:justify">[Sesiones en vivo] Pregunta al experto en <a href="https://www.twitch.tv/amazonalexa" target="_blank">Twitch</a> - todos los mi&eacute;rcoles 10:00am</li> </ul> <h2>Publica una Skill, gana una tarjeta de regalo</h2> <p>Durante un tiempo limitado, ofreceremos tarjetas de regalo de Amazon.com.mx de $500 MXN. a todos aquellos desarrolladores que publiquen una Skill en M&eacute;xico. Empieza ahora a crear usando nuestras plantillas y tutoriales. Consulta t&eacute;rminos y condiciones. <a href="https://developer.amazon.com/es-mx/alexa-skills-kit/alexa-developer-skill-promotion" target="_blank">Participa ahora &gt;&gt;</a>&nbsp;</p> </div> </div> </div> /blogs/alexa/post/7e853a9d-fa65-4b38-bee2-0a777d3f7f5f/alexa-voice-service-expands-to-mexico-with-sonos-bose-harman-kardon-and-jabra Alexa Voice Service Expands to Mexico, with Sonos, Bose, Harman Kardon, and Jabra Adam Vavrek 2018-11-07T16:29:42+00:00 2018-11-07T16:29:42+00:00 <p><a href="https://developer.amazon.com/blogs/alexa/post/7e853a9d-fa65-4b38-bee2-0a777d3f7f5f/alexa-voice-service-expands-to-mexico-with-sonos-bose-harman-kardon-and-jabra" target="_self"><img alt="P18366971_blog_mx_954x240.png" src="https://m.media-amazon.com/images/G/01/DeveloperBlogs/AlexaBlogs/AlexaVoiceService/P18366971_blog_mx_954x240.png._CB479429511_.png?t=true" /></a></p> <p>Following our recent launches in France, Italy, and Spain, Amazon Alexa is excited to announce that we are further expanding the Alexa Voice Service (AVS) capability bringing Spanish language Alexa experiences to customers in Mexico.</p> <p><img alt="P18366971_blog_mx_954x240.png" src="https://m.media-amazon.com/images/G/01/DeveloperBlogs/AlexaBlogs/AlexaVoiceService/P18366971_blog_mx_954x240.png._CB479429511_.png?t=true" /></p> <p>Following our recent launches in France, Italy, and Spain, we are excited to announce that we are further expanding the <a href="https://developer.amazon.com/alexa-voice-service" target="_blank">Alexa Voice Service (AVS)</a> capability bringing Spanish language Alexa experiences to customers in Mexico. Beginning November 12, device makers will be able to access the Mexican Spanish language models in the cloud using the AVS APIs, adding support for multiple languages and localized content to their Alexa built-in products. This launch follows our <a href="https://developer.amazon.com/blogs/alexa/post/cef2f1dc-92c6-499b-8b27-966c7bbfa26d/alexa-skills-kit-expands-to-mexico1" target="_blank">August 2018 announcement</a> that Alexa is coming soon to Mexico.</p> <p>In Mexico, in addition to Echo family of devices, Sonos, Bose, Harman Kardon, and Jabra have announced they will bring Alexa built-in devices to Mexican customers in November. In addition to these Alexa built-in products, customers in Mexico can ask Alexa to stream millions of songs from Amazon Music and access hundreds of skills, including Noticieros Televisa, Cin&eacute;polis, Uber, El Universal, Domino’s, Expansi&oacute;n, Aerom&eacute;xico, Mediotiempo, Kiwilim&oacute;n, Cartoon Network, Philips Hue, TP-Link, Las Estrellas, Milenio, Marat&oacute;n, and others.</p> <h2><strong>Alexa Built-in Products Coming to Mexico</strong></h2> <p><strong>Sonos: </strong>Sonos will add Alexa voice control capabilities to its Sonos One smart speaker and Sonos Beam Smart Soundbar, via a free software update coming soon. With the voice control on Sonos One, Sonos customers in Mexico can ask Alexa to control their entire Sonos home sound system with full voice support for Amazon Music, Deezer, Spotify, or TuneIn. Sonos Beam users will be able to control their TV alongside full music voice control.</p> <p><strong>Bose:</strong> Bose will integrate Alexa into a range of wireless devices, including its QuietComfort 35 II Headphones, Home Speaker 500, Soundbar 500, and Soundbar 700. With proprietary Bose microphone technology for superior voice pick-up and Alexa built-in, these devices will offer Mexican customers instant, easy access to millions of songs and hundreds of skills for information, entertainment, smart home control, and more, from across the room.</p> <p><strong>Harman Kardon: </strong>Harman Kardon will further integrate Alexa into its premium smart speakers, the Allure and Allure Portable. With 360-degree sound, these Alexa built-in devices will offer Mexican customers hands-free voice control for their stunning audio experiences.</p> <p><strong>Jabra: </strong>Jabra will offer one-touch access to Alexa via its range of advanced wireless headphones and earbuds. Customers will be able to ask Alexa to play music, hear the news, check weather, control smart home devices, and much more, on products including Jabra Elite 65t, Elite Active 65t, and 65e Wireless Headphones.</p> <h2><strong>Things to Try with Alexa</strong></h2> <p>You can now speak to, and receive responses from, Alexa in Mexican Spanish on supported devices. Try these sample utterances in Spanish to get started:</p> <ul> <li>Alexa, &iquest;c&oacute;mo est&aacute; el clima?</li> <li>Alexa, a&ntilde;ade leche a mi lista de la compra.</li> <li>Alexa, pon m&uacute;sica para bailar.</li> </ul> <h2><strong>Ready to Launch an Alexa Built-in Product in Mexico? </strong></h2> <p><a href="https://www.amazon.com/ap/register?clientContext=134-9526221-1425229&amp;openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&amp;siteState=clientContext%3D130-5281278-8574150%2CsourceUrl%3Dhttps%253A%252F%252Fdeveloper.amazon.com%252F%2Csignature%3Dnull&amp;marketPlaceId=ATVPDKIKX0DER&amp;language=en_US&amp;pageId=amzn_developer_portal&amp;openid.return_to=https%3A%2F%2Fdeveloper.amazon.com%2F&amp;prevRID=93DVAE7RHWJFGC3A4SNA&amp;openid.assoc_handle=mas_dev_portal&amp;openid.mode=checkid_setup&amp;prepopulatedLoginId=&amp;failedSignInCount=0&amp;openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&amp;openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0" target="_blank">Create your own developer account</a> to get started. Get an overview of AVS and start building with the AVS Device SDK now. Learn about AVS multi-language and localization support on our <a href="https://developer.amazon.com/alexa-voice-service/international/" target="_blank">AVS International page</a>.</p> /blogs/alexa/post/de130c67-0703-4480-a2b3-c9f2977a7dd6/how-to-build-an-alexa-game-skill-from-scratch How to Build an Alexa Game Skill From Scratch Jennifer King 2018-11-06T15:00:00+00:00 2018-11-06T15:00:00+00:00 <p>Get an overview of our latest Twitch series on how to build an engaging game skill from start to finish.</p> <p>In honor of the <a href="https://developer.amazon.com/blogs/alexa/post/559b22ed-07ce-446f-a888-75062089c9a9/build-a-game-skill-for-the-alexa-skills-challenge-games-and-compete-for-over-50-000-in-prizes">Alexa Skills Challenge: Games</a>, we're excited to share a new <a href="https://twitch.tv/amazonalexa" target="_blank">Twitch</a> series on how to build an <a href="https://developer.amazon.com/alexa-skills-kit/gaming">Alexa game skill</a>. Together with my colleague <a href="https://developer.amazon.com/blogs/alexa/author/Jamie+Grossman">Jamie Grossman</a>, we streamed six episodes, during which we covered how to build an engaging voice game experience, from ideation to implementation.</p> <p>If you weren't able to tune into the series on Twitch, here's a recap of each episode along with the best practices we covered. We hope you can use these insights to build your own Alexa game skill.</p> <h2>Episodes 1 + 2: Brainstorming &amp; Voice Design Best Practices</h2> <p>The first session was dedicated to brainstorming a game idea. In order to brainstorm an idea for a voice game, we first needed to recap what works and what doesn't work when it comes to <a href="https://build.amazonalexadev.com/standout-skill-guide-ww.html" target="_blank">build great voice experiences</a>. In <a href="https://www.youtube.com/watch?v=wRvOz_25Zq0&amp;index=3&amp;list=PL2KJmkHeYQTPS29xftrzyySMKeBgJ1Ty2&amp;t=6s" target="_blank">this episode</a>, we did just that. We looked at what aspects of game design work well with voice and which ones don't. For example, in the table below you see some factors that influenced our <a href="https://developer.amazon.com/docs/alexa-design/intro.html">voice-design</a> decisions.</p> <table border="1" cellpadding="1" cellspacing="1" style="height:223px; width:618px"> <tbody> <tr> <td><strong>Good Voice Design Decisions</strong></td> <td><strong>Voice Design Decisions to Avoid</strong></td> </tr> <tr> <td>Turn-based/asynchronous interactions</td> <td>Real-time interactions</td> </tr> <tr> <td>Short/concise inputs</td> <td>Long-form complex inputs</td> </tr> <tr> <td>Deterministic inputs (yes/no/closed list)</td> <td>Non-deterministic inputs</td> </tr> <tr> <td>Optional/progressive enhancements</td> <td>Complex settings/visuals</td> </tr> <tr> <td>Puzzle/RTS/questions/logic/stories</td> <td>Movement/complex time-based interactions</td> </tr> </tbody> </table> <p>You might look at some of the items in the left column and wonder why they aren't recommended. Those are mechanics that are harder to implement effectively given how voice works and how we interact with Alexa-enabled devices. For example, any input needs to be processed and sent back to the skill back end, and we need to listen to the response before we can take a subsequent action. Therefore, things like real-time interactions become tricky as several parts of the communication chain can incur bottlenecks or delays for whatever reason (such as a slow API call or a user that doesn't answer in time).</p> <p>We also wanted to keep the inputs relatively simple, mainly to keep the back-end logic manageable. If we were to have long, non-deterministic inputs, it becomes harder to solely rely on the <a href="https://developer.amazon.com/alexa-skills-kit/asr">automatic speech recognition (ASR)</a> and<a href="https://developer.amazon.com/alexa-skills-kit/nlu"> natural language understanding (NLU)</a> engines of Alexa, as some of those semantics will need to be parsed and processed on our own back end.</p> <p>The beauty of Twitch, is that viewers can actively participate in your creative process. During the episode we leveraged our Twitch audience and brainstormed some ideas with the viewers. After a good amount of back and forth, the end result was an idea for a game called Memory Market. Essentially a memory game, where the user is auditioning to be Alexa’s helper, and the main test is to help remember customer’s shopping lists. Therefore, Alexa asks increasingly difficult things to remember and different aisles of the supermarket represent more and more difficult levels.</p> <p>Watch the full episode <a href="https://youtu.be/wRvOz_25Zq0" target="_blank">here</a>:</p> <p style="text-align:center"><iframe allowfullscreen="" frameborder="0" height="360" src="//www.youtube.com/embed/wRvOz_25Zq0" width="640"></iframe></p> <h2>Episodes 3 + 4: Planning &amp; Prototyping the Game Skill</h2> <p>With the idea we created in the first two episodes as our north star, we heeded the age-old saying: weeks of programming can save you hours of planning. We therefore dedicated almost the entire episode to planning out as much as possible exactly what we would need for our game. We mapped out the level progression, point system, question structure, inputs, some of the preliminary copy as well as some code-design decisions: how to structure the attributes/states of our game, and, most importantly, what intents, slots and slot types we would need. You can find the recording <a href="https://www.youtube.com/watch?v=Ps4sOwsOhwk&amp;list=PL2KJmkHeYQTPS29xftrzyySMKeBgJ1Ty2&amp;index=3" target="_blank">here</a>.</p> <p>In order to truly understand what sort of interaction model we would be building, we started by mocking the interaction between us continuously incorporating suggestions from the viewers of the stream. Once we got a back and forth interaction that satisfied us and the viewers, we proceeded to dissect it and pick out what intents we would need. We concluded really only one main AnswerIntent was needed as we would manage the state in the back end.</p> <p>Then we thought of how the user inputs (i.e. the answer utterances of the AnswerIntent) would work. If you remember from the blog post on <a href="https://developer.amazon.com/blogs/alexa/post/fae82327-15dc-4f31-9b52-11ef75203bfc/best-practices-for-building-voice-enabled-games">principles for building good voice games</a>, we discussed how some games leverage a simple input mechanic (such as <a href="https://www.amazon.co.uk/Volley-Inc-Yes-Sire/dp/B071ZR5HKR/" target="_blank">Yes Sire</a> where the user only says Yes or No). By designing your game so that the input is simple, you drastically reduce the cognitive load of formulating an answer for the user, and simplify the parsing of the answer on the backend. In our example, we ended up decided that any answer could have one, two or three food items, and consequently any question that we asked to the user, always clearly asked for one. The points will be calculated according to how many items are recalled (up to three).</p> <p>Here's what the interaction model and AnswerIntent looks like:</p> <p><img alt="" src=" https://m.media-amazon.com/images/G/01/DeveloperBlogs/AlexaBlogs/default/game_skill_image.jpg._CB479345728_.jpg" style="display:block; margin-left:auto; margin-right:auto" /></p> <p>We concluded the session by quickly sketching out the back-end code, using our favorite AWS Lambda scaffolding tool: <a href="http://alexa.design/codegenerator" target="_blank">the code generator</a>. One thing to remember about using this tool is that it generates a lot of code. Make sure you are familiar with <a href="https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs#samples" target="_blank">some of the basic templates</a> to understand what is a helper function and what is a core part of the Alexa Skills Kit (ASK) Software Development Kit (SDK) for NodeJS.</p> <p>Watch the full episode <a href="http://www.youtube.com/watch?v=Ps4sOwsOhwk&amp;list=PL2KJmkHeYQTPS29xftrzyySMKeBgJ1Ty2&amp;index=3" target="_blank">here</a>:</p> <p style="text-align:center"><iframe allowfullscreen="" frameborder="0" height="360" src="//www.youtube.com/embed/Ps4sOwsOhwk" width="640"></iframe></p> <h2>Episodes 5 + 6: Implementation</h2> <p>In the final episodes, we went more into the meaty back-end development. Due to time constraints, some of the work was done offline in order to focus on the key concepts during the stream, such as <a href="https://developer.amazon.com/blogs/alexa/post/baee53c1-5b03-4580-b57a-ee9510413354/amazon-polly-voices-in-alexa-skills-now-generally-available">Amazon Polly integration</a>,<a href="https://developer.amazon.com/blogs/alexa/post/285a6778-0ed0-4467-a602-d9893eae34d7/how-to-localize-your-alexa-skills"> localization</a>, <a href="https://developer.amazon.com/blogs/alexa/post/648c46a1-b491-49bc-902d-d05ecf5c65b4/tips-on-state-management-at-three-different-levels">state management</a>, <a href="https://developer.amazon.com/blogs/alexa/post/08edaa00-59e2-46b7-aace-4080f2a87450/using-session-attributes-in-your-alexa-skill-to-enhance-the-voice-experience">session attributes</a>, persistence. You can find the recording <a href="https://www.youtube.com/watch?v=SS1LWlOnxRI&amp;index=4&amp;list=PL2KJmkHeYQTPS29xftrzyySMKeBgJ1Ty2" target="_blank">here</a>.</p> <p>We recently announced that <a href="https://developer.amazon.com/blogs/alexa/post/baee53c1-5b03-4580-b57a-ee9510413354/amazon-polly-voices-in-alexa-skills-now-generally-available">you can now use SSML to use Amazon Polly voices</a>. This feature wasn't available when this episode aired, but we ended up writing an Alexa-to-Polly integration layer with built-in S3 caching. This has been packaged as an <a href="https://npmjs.com/package/alexa-polly" target="_blank">NPM module</a> if you still want to use it, which you can find <a href="https://npmjs.com/package/alexa-polly" target="_blank">here</a>. Keep in mind we recommend <a href="https://developer.amazon.com/docs/custom-skills/speech-synthesis-markup-language-ssml-reference.html#voice">you use SSML now that it's available</a> to integrate Amazon Polly voices, unless you are trying to use languages currently not supported.</p> <p>Another aspect we covered during the stream is localization, and how to incorporate several languages powered by the same underlying AWS Lambda function. You can see exactly in what this consists of by checking out my previous blog post on <a href="https://developer.amazon.com/blogs/alexa/post/285a6778-0ed0-4467-a602-d9893eae34d7/how-to-localize-your-alexa-skills">how to localize your Alexa skills</a>.</p> <p>Last, we covered topics such as score keeping, maintaining state, session attributes, and data persistence. If you weren't able to make the stream, you can check out how to incorporate all of the above by following some of our existing tutorials found on our <a href="https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs#samples" target="_blank">GitHub repository</a> such as the <a href="https://github.com/alexa/skill-sample-nodejs-highlowgame" target="_blank">high-low game</a> and the <a href="https://github.com/alexa/skill-sample-nodejs-trivia" target="_blank">trivia</a> templates.</p> <p>Watch the full episode <a href="http://www.youtube.com/watch?v=SS1LWlOnxRI&amp;index=4&amp;list=PL2KJmkHeYQTPS29xftrzyySMKeBgJ1Ty2" target="_blank">here</a>:</p> <p style="text-align:center"><iframe allowfullscreen="" frameborder="0" height="360" src="//www.youtube.com/embed/SS1LWlOnxRI" width="640"></iframe></p> <h2>Join Us Every Week on Twitch</h2> <p>If you have questions about this Twitch series or want to share your own game skill ideas with us, please reach out to <a href="http://twitter.com/muttonia" target="_blank">@muttonia</a> and <a href="http://twitter.com/jamielliottg" target="_blank">@jamielliottg</a> on Twitter.</p> <p>You can find the Alexa team on Twitch every week at <a href="https://www.twitch.tv/amazonalexa" target="_blank">twitch.tv/amazonalexa</a>. If you would like to get notifications every time we stream, make sure to follow our channel by clicking the purple heart icon. You can also tune into Twitch every Tuesday at 1 pm PT for Alexa Office Hours. During these weekly one-hour sessions, a rotating cast of Alexa evangelists are available to answer your skill-building questions.</p> <h2>Related Content</h2> <ul> <li><a href="https://developer.amazon.com/alexa-skills-kit/gaming">Alexa for Gaming</a></li> <li><a href="https://developer.amazon.com/blogs/alexa/post/fae82327-15dc-4f31-9b52-11ef75203bfc/best-practices-for-building-voice-enabled-games">Best Practices for Building Voice-First Games for Alexa</a></li> <li><a href="https://github.com/alexa/skill-sample-nodejs-quiz-game">Build an Alexa Quiz Game</a></li> <li><a href="https://github.com/alexa/skill-sample-nodejs-trivia">Build an Alexa Trivia Game</a></li> <li><a href="https://developer.amazon.com/blogs/alexa/post/648c46a1-b491-49bc-902d-d05ecf5c65b4/tips-on-state-management-at-three-different-levels">Tips on State Management at Different Levels</a></li> </ul> <h2>Build Skills, Earn Developer Perks</h2> <p>Bring your big idea to life with Alexa and earn perks through our <a href="https://developer.amazon.com/alexa-skills-kit/alexa-developer-skill-promotion">milestone-based developer promotion</a>. US developers, publish your first Alexa skill and earn a custom Alexa developer t-shirt. Publish a skill for Alexa-enabled devices with screens and earn an Echo Spot. Publish a skill using the Gadgets Skill API and earn a 2-pack of Echo Buttons. If you're not in the US, check out our promotions in <a href="https://developer.amazon.com/alexa-skills-kit/alexa-developer-skill-promotion-canada">Canada</a>, the <a href="http://developer.amazon.com/en-gb/alexa-skills-kit/alexa-developer-skill-promotion" target="_blank">UK</a>, <a href="http://developer.amazon.com/de/alexa-skills-kit/alexa-developer-skill-promotion" target="_blank">Germany</a>, <a href="https://developer.amazon.com/ja/alexa-skills-kit/alexa-developer-skill-promotion">Japan</a>, <a href="https://developer.amazon.com/fr/alexa-skills-kit/alexa-developer-skills-promotion">France</a>, <a href="https://developer.amazon.com/alexa-skills-kit/anz/alexa-developer-skill-promotion">Australia</a>, and <a href="http://developer.amazon.com/alexa-skills-kit/alexa-developer-skill-promotion-india" target="_blank">India</a>. <a href="https://developer.amazon.com/alexa-skills-kit/alexa-developer-skill-promotion">Learn more</a> about our promotion and start building today.</p>