concept control in category alexa

appears as: control, control
Voice Applications for Alexa and Google Assistant

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

You can’t control how a user will respond, but you can shape their response. You’ll see some methods for doing this in chapter 8.

We can let Alexa handle the dialog because at each step in the dialog, Alexa sends the fulfillment an intent request that also contains a property named dialogState. In figure 8.2, you see the dialogState change as the dialog moves forward. Until every slot is filled and all information is confirmed, dialogState will have a value other than COMPLETED. The intent can check for the presence of this value and pass back control to Alexa if it’s not present. Alexa will use responses defined in the dialog model to speak to the user.

Listing 8.15 Returning intent to Alexa (./lambda/custom/index.js)
const BuyTicketsIntentHandler = {
  ...
  handle(handlerInput) {
    ...
    if (handlerInput.requestEnvelope.request.dialogState !== dialogComplete) {
      ...
      return handlerInput.responseBuilder    #1  
        .addDelegateDirective(intent)    #1  
        .getResponse();    #1  
    } else {
      ...
    }
  }
};

#1   If the dialog isn’t complete, pass back control with the current intent to Alexa.

We use the addDelegateDirective method to hand control back to Alexa. We are, in fact, delegating control to Alexa. Through this delegation, we are saying that Alexa should use the prompts we outlined in the interaction model to complete the next step of elicitation or confirmation.

Figure 11.5 We provide control to Assistant for part of the daily update registration flow.

c11_05.eps