concept action in category alexa

appears as: n action, ctions, ction, action, Actions, An action, actions
Voice Applications for Alexa and Google Assistant

This is an excerpt from Manning's book Voice Applications for Alexa and Google Assistant.

Sample utterances are possible phrases that a user might use to perform an action with Alexa. These utterances are then used to train the Alexa platform by building a statistical model that takes what the user says and matches it against what you said users might say. For example, if you have the utterances “turn up the volume” and “turn up the sound,” it’s unlikely that the speaker is discussing famed children’s party performer Turnip the Clown. As anyone who has had to give an impromptu speech or toast can attest, speaking off the cuff can be difficult, and there are a lot of starts, stops, and filler words. The sample utterances are useful for providing an idea of what might be in there.

Assistant provides a handful of ways to proactively interact with users. With routine suggestions, developers can suggest that users add an action to a routine they are already using with Assistant, like waking up or leaving the house. (This would have been useful in the sleep-tracking skill we built chapters back.) Daily updates will do just what it sounds, which is send users a notification every day at a set time. Notifications, meanwhile, happen whenever there’s relevant information to send the user.

Assistant has a user-facing feature called routines. Users set this up to perform specific actions when they say a specific trigger to Assistant. Indeed, as shown in figure 11.1, these actions can span multiple applications. A user can say a phrase such as “Okay Google, good morning,” and Assistant will perform the actions that the user has specified within the Assistant app ahead of time. Perhaps the user wants Assistant to turn on the lights, say the weather, give a voice UI tip, and then play music.

Figure 11.1 A routine invokes multiple actions in multiple applications.

c11_01.eps

The developer doesn’t need to know what is happening within the routine. The developer just needs to provide an action that Assistant can trigger on its own. This means that the action needs to be what’s called a “one-shot” intent, or an intent that doesn’t need any extra information or interaction from the user.

Listing 11.3 Providing a daily update suggestion (index.js)
app.intent("office_locations", (conv, {room}) => {
  ...
  if (!conv.user.storage.update) {    #1  
    conv.ask(new Suggestions("Get a daily update"));    #2  
    conv.ask(new SimpleResponse({    #3  
      speech: response,
      text: displayText
    }));
  } else {
    conv.close(new SimpleResponse({
      speech: response,
      text: displayText
    }));
  }
});

#1   Checks whether the user already has the action set as a daily update
#2   Suggests the user add the action as a daily update
#3   Waits for the user’s response

Here we display a suggestion chip that gives the user a way to add the action as a daily update. This doesn’t yet add the daily update—it merely provides the first step in the process. We don’t want to nag (how annoying is that in human-to-human conversations?), so we only show the chip to users who haven’t already accepted the suggestion.