Tutorial: Use the Developer Console to Create a Skill for an Android App
This tutorial walks you through how to create a fictional "City Guide" skill for an Android app by using the Alexa Skills Kit developer console. No code is required.
Steps to create a skill for an Android app
To create a skill for an Android app, take the following steps:
- Create a skill and provide deep links to an Android app.
- Select an app category.
- Add an intent and slots.
- Add example phrases.
- Review and build the skill.
- Test the skill.
Step 1: Create a skill and provide deep links to an Android app
In this step, you create a skill based on the App/Website model. Then, you enter the deep links that you want Alexa to send the user to when the user opens the skill.
To create a skill and provide deep links to a website
- Log in to the Alexa Skills Kit developer console.
- Click Create Skill.
- For Skill name, enter
City Guide
. - For this tutorial, leave the Primary locale at its default value.
For a real skill, you might choose a different primary locale or add additional locales later, to expand your user reach. A locale is a combination of a language and a location. For example,en-IN
is a locale that represents the English language spoken in India. - For Choose a model to add to your skill, select App/Website.
- At the top right, click Create skill.
- On the Step1: Add app & invocation name page, select Add your Android apps.
- For Google Play Store ID, enter
com.example.app
- For App name, enter
City Guide
.
The Google Play Store ID and your Android app name are used to redirect the user to your app's page on the Google Play Store. In those cases, Alexa says something like, "To <requested intent>, you'll need to download the app. Here's <App Name> on the App Store." - For Skill invocation name, enter
city guide
(all lower case). - For What should Alexa do when a user says Alexa, open <skill invocation name>? select Open your app or website.
Note: In other cases, you might choose for Alexa to say a list of things to try instead of taking the user to the app.
- Under Android Deep Links, for Android target, select
City Guide (com.example.app)
. - For Deep link type, select
ANDROID_PACKAGE
. - For Deep link, enter
com.example.app
- For Fallback if the app is not installed, enter
https://play.google.com/store/apps/details?id=com.example.app
- At the top right, click Save & Next.
Step 2: Select an app category
In this step, you select the category that best describes the app. In this example, the app is "City Guide," so you choose Maps and Navigation. Every category comes with customizable pre-built intents. Some categories, like Maps and Navigation, also include custom pre-built intents specific to that category. For this category, an example of a custom intent is "Alexa, ask City Guide to find a Whole Foods near me." If a category doesn't have an example utterance at the bottom of its tile, the category doesn't have a pre-built set of custom intents.
To select an app category
- Continuing from the previous step, on the Step 2: Select your app category page, select Maps and Navigation.
- At the top right, click Save & Next.
Step 3: Add an intent and slots
In this step, you specify an intent that the app can handle. An intent represents an action that fulfills a user's spoken request. For App/Website skills like this one, when the user makes the request that maps to an intent, Alexa takes the user to the specified deep link within the app or website. Intents can optionally have arguments called slots.
Skills can have multiple intents and each intent can have multiple deep links.
In this example, you select the pre-built NAVIGATION_SearchLocations intent. This intent captures the following user questions (and many more):
- find {establishment}
- find a location in {region}
- find a location near {streetName}
- search for {streetAddress}
As you can see from the previous user questions, this intent has four possible slots:
- {establishment}
- {region}
- {streetName}
- {streetAddress}
When you configure the skill in the next procedure, you add a URL parameter that you then link to a slot. All pre-built slots have a pre-built slot mapping. You can edit the slot mapping if required.
To add an intent and the required slots
- Continuing from the previous step, scroll down to Navigation pre-built intents, and then, next to NAVIGATION_SearchLocations, click Add Intent.
At the top of the page, an intent appears in the Added Intents list. The intent requires configuration, which you do next.Note: Scroll down to see additional pre-built intents you can pick from. You can also create custom intents. - Under Added Intents, next to NAVIGATION_SearchLocations, click Configure.
- Under the utterance chart at the top, click View more examples to see a complete list of utterances that this intent covers.
- Scroll down beneath the table, and under What links should Alexa fire when a user interacts with this intent?, leave Single deep link template (default) selected.
- Select Add deep links for Android.
- For Android app, select
City Guide (com.example.app)
. - Click Add Android deeplinks.
- In the Add a deeplink dialog box, under Link type, select ANDROID CUSTOM INTENT.
- For Alexa link format, enter
intent:#Intent;package=com.example.app;action=com.example.app.SEARCH{;establishment};end
, and then click Add link.Note:establishment
is the parameter of the user utterance.
The deep link is added to the deep link list. - For the deep link you just added, next to the
establishment
parameter, click Link slot. - For the
establishment
URL parameter, select slot{establishment}
. - Leave the other fields at their default values, so that the
{establishment}
slot type is a variable of typeAMAZON.LocalBusiness
.
If you want to make sure that the slot type covers certain values, you can add your own slot type values. This action appends the values you provide to the built-in values defined by Amazon. For example,AMAZON.LocalBusiness
provides names of businesses. If you want to include additional businesses – such as smaller businesses that might not be included – you can add them to the list. The slot then recognizes both the original set of values as well as the custom values you added.Important: Your parameters must be able to accept all of the slot type values mapped to them. Built-in slot types have many permutations and combinations of values. If your deep link is sensitive and can only accept a limited set of values, you should create your own slot type.Note: If you ever selectAMAZON.DATE
orAMAZON.DURATION
, you have the option to use or create a slot transformation so that the formats work with your URLs. For details, see Transform Slots Into Formats Your URLs Accept. - Click Save.
- (Optional) Repeat steps 6 through 12 to add Android deep links that map to the three additional slots:
Link type Alexa link format URL parameter slot ANDROID CUSTOM INTENT
intent:#Intent;package=com.example.app;action=com.example.app.SEARCH{;streetName};end
{streetName}
(The slot type populates toAMAZON.StreetName
.)ANDROID CUSTOM INTENT
intent:#Intent;package=com.example.app;action=com.example.app.SEARCH{;establishment, streetName};end
{establishment} and {streetName}
(The slot types populate toAMAZON.LocalBusiness
andAMAZON.StreetName
.)ANDROID CUSTOM INTENT
intent:#Intent;package=com.example.app;action=com.example.app.SEARCH;end
None
Note: The last deep link should be a link that handles most edge cases. Ideally, this deep link shouldn't contain a URL parameter. That way, it can handle all utterances that don't have a slot, as well as when the user forgets to add a slot. Alexa doesn't support multi-turn dialogs in this skill type. - At the top right, click Save Intent.
- After you return to the Intents page, click in to the NAVIGATION_SearchLocations configuration again, and make sure that you have four deep links specified: one for each slot.
- At the top of the Intents page, click Save & Next.
For a real skill, you typically add many more intents. You map each intent to a deep link that you want to send the user to when they say that intent, and you specify the slot type for any slots that the intents contain. - On the Slot Types page, ensure that there are four slots listed, and then click Save & Next.
Step 4: Add example phrases
In this step, you add example phrases to let the user know what types of requests they can make of the skill.
To add example phrases
- On the Discover "What can I say" page, in the Example phrase 1 box, enter
find a whole foods
(all lower case).
This gives the user an idea of the type of request the website can handle. - Add a few more example phrases, like
search for a whole foods on main street
andfind a whole foods on madison street
. - At the top of the page, click Save & Next.
Step 5: Review and build the skill
In this step, you review your skill configuration and then you build the skill.
To review and build the skill
- On the Review page, ensure that all of the steps have green check marks.
- To add or change any settings, click Edit, edit the setting, and then navigate back to the Review page.
- Click Build.
The build takes a few minutes.Note: If the build fails, click Build again. If it still fails, go back to the previous steps to be sure you didn't miss anything.
Step 6: Test the skill
To test the skill, you must first enable the skill for testing by using the Test tab in the developer console. Then, you can test the skill's deep-linking functionality in a few ways:
- With the Alexa simulator in the developer console – The simulator operates as if it is an Echo device. Because the simulator is an Echo device, Alexa sends the deep link to your phone as a push notification. When you tap the notification, the link takes you to the website.
- With the Alexa app on your phone – The Alexa app must be registered to the same account as the account with which you created the skill. When you open the skill, Alexa attempts to open the City Guide app on your phone. Because City Guide isn't on your phone, Alexa sends you to the Google Play Store.
- With an Echo device – The Echo device must be registered to the same account as the developer account with which you created the skill. When you open the skill, Alexa sends the deep link to your phone as a push notification. When you tap the notification, the link takes you to the website.
To enable testing for the skill
- After the build completes, in the developer console, at the top, click the Test tab.
- At the top left, next to Test is disabled for this skill, click the box, and then select Development.
The option changes to Skill testing is enabled in with Development selected.
To test the skill with the Alexa simulator
- Ensure that you enabled testing for the skill, as previously described.
- Still in the Test tab, on the left, in the box that says, Type and click or hold the mic, type
open city guide
, and then press enter.
Alexa says something like, "I'll send a link to open city guide. I should send that to <developer account name>, right?" When you say "Right," Alexa says, "Okay, sending to <developer account name>". - Check your phone for the notification.
If you enabled push notifications from Alexa, your phone should receive a message that deep links to the website called "Example Domain."
To test the skill with the Alexa app
- Ensure that you enabled testing for the skill, as previously described.
- Open the Alexa app, which is registered to the same account as the developer account with which you created the skill.
- Click the Alexa logo, and then say, "Open City Guide."
Alexa says something like, "To open City Guide, you'll need to download the app. Here's City Guide on Google Play." Google Play then displays a "Try again" error page because this example app doesn't exist.
To test the skill with an Echo device
- Ensure that you enable testing for the skill, as instructed previously.
- On an Echo device that's registered to the same account as the developer account with which you created the skill, say, "Alexa, open City Guide."
Alexa says something like, "I'll send you a link to open City Guide." - Check your phone for the notification.
If you enabled push notifications from Alexa, your phone should receive a message that deep links to the website called "Example Domain."
Related topics
- About Alexa for Apps
- Use the Developer Console to Create a Skill for an App or Website (No Code)
- Tutorial: Use the Developer Console to Create a Skill for an iOS App
- Tutorial: Use the Developer Console to Create a Skill for a Website
Last updated: Apr 25, 2022