Since the Alexa Skills Kit Developer Preview launched in June, we’ve continued to roll out new features and documentation based directly on your feedback. Today we are adding three highly requested features as built-in intents for use with your own skills: help, stop and cancel. We’re also adding a new Amazon slot type for US cities. These new intents will enable you to control how Alexa responds to customers requesting her to stop an action or ask for help while running your skill.
The Alexa Skills Kit provides a collection of new built-in intents. These are intents for very common actions that you can choose to implement without providing any sample utterances. For example, the built-in AMAZON.HelpIntent is automatically mapped to common ways of requesting help from a skill. If you choose to use this intent, users can invoke your skill, say something like “help”, and the Alexa service sends your service an IntentRequest for the AMAZON.HelpIntent. Your service can handle this intent in a way appropriate for your skill. Built-in intents save you the trouble of having to write multiple sample utterances for the intent and give your skill a consistent, common way to work with.
The Alexa Skills Kit currently supports three built-in intents: AMAZON.CancelIntent, AMAZON.HelpIntent and AMAZON.StopIntent.
Since earlier versions of the Alexa Skills Kit did not provide these built-in intents, you may have implemented your own versions of cancel, stop or help. Although these continue to work, you may want to migrate to the built-in intents to take advantage of improvements to the utterances over time.
Using the new built-in intents is fairly simple. You just need to add the intent to your existing intent schema and then handle the new intent when your service is called from Alexa.
Here is an example of an updated Intent Schema that use two new built-in intents:
{
"intents": [
{
"intent": "GetFirstEventIntent",
"slots": [
{
"name": "day",
"type": "AMAZON.DATE"
}
]
},
{
"intent": "GetNextEventIntent"
},
{
"intent": "AMAZON.HelpIntent"
},
{
"intent": "AMAZON.StopIntent"
}
]
}
Here is an example of handling the new Intent request with a NodeJS, AWS Lambda Compute function:
// Dispatch to your skill's intent handlers
if ("MyColorIsIntent" === intentName) {
setColorInSession(intent, session, callback);
} else if ("WhatsMyColorIntent" === intentName) {
getColorFromSession(intent, session, callback);
} else if ("AMAZON.HelpIntent" === intentName) {
getWelcomeResponse(callback);
} else if ("AMAZON.StopIntent" === intentName) {
exitSkill();
}
else {
throw "Invalid intent";
}
If you were using Java Servlets within an AWS Beanstalk environment the code would be very similar:
if ("GetFirstEventIntent".equals(intentName)) {
return handleFirstEventRequest(intent, session);
} else if ("GetNextEventIntent".equals(intentName)) {
return handleNextEventRequest(session);
} else if ("AMAZON.HelpIntent".equals(intentName)) {
// Handling for the help intent goes here
} else if ("AMAZON.StopIntent".equals(intentName)) {
// Handling for the stop intent goes here.
} else {
throw new SpeechletException("Invalid Intent");
}
Because users will request built-in intents using standard, common phrases, your service should handle the intent in a way consistent with the intended purpose. For instance, providing some other, non-help related functionality for the AMAZON.HelpIntent would confuse users who expect help when saying something like “help” or “what can you do?”
Also note, built-in intents do not include any slots. If you need slots, you will need to create a custom intent and write your own sample utterances.
In addition to the existing Built-in Slot types we are now adding an AMAZON.US_CITY slot. This new slot type provides handling for major cities in the United States. All cities with a population over 100,000 are included. Note that this type cannot be extended with additional cities. If you are defining a slot that needs to support cities that aren’t included, you should define a custom slot type and provide all the values instead. By using the new AMAZON.US_CITY slot type you will no longer need to create multiple sample utterances within your interaction model for Alexa to understand when cities are spoken by your users.
Don’t forget to check out the Alexa developer forums! There are now over 3,000 messages posted by developers like you sharing their latest creations, troubleshooting issues, and submitting feedback. We want to hear from you!
The Alexa community has been creating some great projects and resources. Here are a few we want to give a shout out to:
In the coming weeks I will be hosting a couple of Alexa webinars on getting started with the Alexa Skills Kit and an overview of Voice Design. You can sign up for the webinars here:
Voice Design 101
Register for 7 am PT/ 10 am ET on Thursday November 12th
Register for 1 pm PT/ 4 pm ET on Thursday November 12th
Introduction to the Alexa Skills Kit
Register for 7 am PT/ 10 am ET on Tuesday, November 17th
Register for 1 pm PT/ 4 pm ET on Tuesday, November 17th
Our Alexa sessions from AWS re:Invent 2015 are also now available online, free and on demand. These sessions include everything you need to get started as an Alexa developer, real world tips and advice, as well as first hand Alexa Skill creation experiences told directly from Capital One and BMW. Read my AWS re:Invent wrap up post for links to all the recordings and slides.
-Dave (@TheDaveDev)
Want Amazon Developer blogs delivered to your inbox? Stay in the loop on the latest industry best practices, Amazon promotions, and new launches by subscribing to our weekly blog summary here.