Manage Learn to apply best practices and optimize your operations.

Five Alexa tricks to build better, more interactive skills

Amazon Echo allows businesses to connect with consumers via Alexa skills, but voice interactions come with different challenges than standard graphical user interfaces.

Many software developers struggle with visual UI design, but the rise of Alexa has brought a new frontier -- speech...

interface design -- that comes with its own set of complexities.

Speech is very different from visual presentation. A person listens to a sentence just once, as it is spoken; he or she can't go back and hear it again. A speech application with, for example, a simple 10-item list strains the limits of voice interaction. This is especially true with a computer-generated voice, which lacks a variety of inflection and nuance. It's easy to lose patience with this method of interaction.

But applications with voice interfaces are in style, buoyed by popular consumer devices, such as Amazon Echo and Google Home. Below are some Amazon Alexa tricks to succeed with this new medium.

Vary the interaction

Some Alexa skills -- voice-based applications built specifically for Alexa -- answer a single question, which completes the interaction. Other skills are more conversational, enabling the end user to make a series of requests that trigger Alexa responses. For example, in my Premier League soccer skill, an end user can ask a variety of questions about the table, about a particular team and about various statistics.

After answering each question, the Alexa skill asks the user what they want to do next. Rather than repeat the same prompt, my skill randomly selects from a variety of similar prompts. This is one of several Alexa tricks that makes the interaction truer to normal conversation. Here is how my skill approaches the conversational tone:

<code>

var prompts = {

    "help": [

        "Say get table, or say a team name ",

        "Ask about the table, or a team ",

        "Say a command ",

        "We can tell you about teams or the table "

        ]

};

function randomPrompt() {

    return prompts.help[Math.floor(Math.random() * prompts.help.length)];

}

</code>

Adjust Alexa to the user

Developers should also keep in mind the end user's level of experience with Alexa. The new Alexa software development kit makes it trivial to record data about each user. For example, by adding a single line of code to a Lambda function, AWS will store all invocation variables in a per-user DynamoDB table, such as how many times a user interacted with the skill. This essentially preserves your state across invocations.

Another of my skills, More Screen Time, gives detailed instructions the first three times the skill is invoked, uses a statistical model to give less-detailed instructions the next 12 times the skill runs and then skips the instructions completely. Developers can use this sort of technique, shown below, in a variety of ways, such as analyzing patterns and welcoming back an end user after an absence.

<code>

function buildWelcome(emmiter) {

    if(invocation_count < 3) {

       return spliceTODintoWelcome(emmiter.t(‘DETAILED_HELP'));

    }

    if (invocation_count < (Math.random() * 12)) {

        return spliceTODintoWelcome(emmiter.t('MINI_HELP'));

    } else {

        return spliceTODintoWelcome(emmiter.t('WELCOME'));

    }

}

</code>

Progressive disclosure of options

Voice interface design also involves a large set of options. In a visual application, a developer can build a 10-item drop-down list. But that doesn't work in an auditory environment. If you list all the options at the start of the interaction, end users will become bored and likely forget options. Conversely, if you don't tell users all the options, they won't discover the full capability of your skill.

To address this, the Premier League skill maintains a list of possible commands and a list of used commands, as shown in the code below. Each time Alexa prompts the end user, it starts with one of the random main prompts, but then, it adds a random suggestion from the list of all possible commands. The skill tracks which questions it asks and randomly suggests an unused question. This helps guide the user to gradually learn the full capabilities of the Alexa skill.

Given even a modest set of main prompt options and extra commands, Alexa has a large set of potential phrases, which reduces repetition and enhances the overall experience.

<code>

  var extraCmdPrompts = new Map();

  extraCmdPrompts.set("redcards", ". you can also say red cards");

  extraCmdPrompts.set("yellowcards", ". you can also say yellow card");

  extraCmdPrompts.set("cleansheets", ".  you can also ask about clean sheets");

  extraCmdPrompts.set("goals", ". you can also ask about goals");

  extraCmdPrompts.set("relegation", ". you can also ask about relegation");

  extraCmdPrompts.set("fixtures", ". you can also ask about fixtures");

    'RedCardIntent': function() {

        extraCmdPrompts.delete('redcards')

        var say = "the players with the most red cards are, ";

        loadStats(this, say, 5, "redcards", ", with ", " has ", 1, 2, 4, this.t('HELP'));

    }

// This command lets us suggest commands to the user that they have not yet used

function suggest() {

    var suggestionsLeft = extraCmdPrompts.size;

    if(parseInt(suggestionsLeft) > 0) {

        var firstKey = Array.from(extraCmdPrompts.keys())[0];

        var firstValue = extraCmdPrompts.get(firstKey);

        extraCmdPrompts.delete(firstKey);

        return firstValue;

    }

    return ''

}

</code>

Alexa tricks for configuration

The same principle applies to Alexa configuration. Our company wrote a custom Flash Briefing skill focused on our internal infrastructure. In this skill, we had a large number of possible sources of internal news items relating to our projects and infrastructure, such as trouble tickets, system availability and customer outages. We wanted users to configure which news sources to include in the briefing. In a visually configured system, the set of news sources would display as a set of checkboxes. But that's not an option with Alexa. There are several approaches developers can take here.

Some developers choose a hybrid approach in which they configure the skill visually, but for verbal use. This typically means creating a webpage where application configuration occurs. A developer could also build a voice interaction model that allows for a gradual configuration of the system. An example of this is a flash briefing that starts by including all news sources but asks the end user, "Include this news source?" The user can respond with his or her preferences to configure the system verbally.

Link accounts

If you create an Alexa skill, you want everyone to have access to it. But if you create a business skill, you probably want to restrict access to your own employees.

Account linking lets developers or users link Alexa skills to certain credentials. For example, if developers want to limit a skill to business usage and employees, they can link the skill to an existing OAuth system. End users, on the other hand, can link external credentials to a skill to order a pizza or hail an Uber.

These Alexa tricks can go a long way toward making a skill more accessible and enjoyable to the users an enterprise wants -- and only those users.

Next Steps

Amazon Alexa features lend to future enterprise use

Go beyond Echo with Alexa in the enterprise

Alexa's machine learning skills boosted by Lex

This was last published in September 2017

Dig Deeper on AWS tools for development

Join the conversation

2 comments

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

What are the use cases for business-facing Alexa skills?
Cancel
You can see the Alexa PremierLeague skill described in the article here:
Cancel

-ADS BY GOOGLE

SearchCloudApplications

TheServerSide.com

SearchSoftwareQuality

SearchCloudComputing

Close