Reprompts

You can use the following features when handling cases where users don't provide input to your app (no-input errors):

  • System-default reprompts - These reprompt the user automatically with pre-canned reprompts that are generic for all cases.
  • Static reprompts - Specifying a set of reprompts as part of your response to the Google Assistant. This allows you to specify up to three different reprompt phrases and lets the Assistant handle the reprompting for you.
  • Dynamic reprompts - Declaring that you want to handle reprompting on your own, and receiving an intent (Actions SDK) or event (Dialogflow) everytime a no-input occurs, so you can handle them on a case-by-case basis.

System-default reprompts

By default, when you return a response to the Assistant, the system uses default reprompts to ask users to repeat or retype their input. The Assistant tries up to two more times to obtain input from the user, for a total of 3 attempts. The Assistant exits your app on the third time it doesn't receive input.

Static reprompts

When you return a response to users, you can provide a set of static reprompts that the Assistant speaks to users when it can't detect any input. The Assistant speaks these rerompts in order, and you can specify two reprompt messages and one last goodybe message.

For example, with the following Node.js client library code, the Assistant asks the user to "Guess a number". If it doesn't detect any input, it reprompts the user two more times with the provided prompts. If it still doesn't receive any input, it speaks the last phrase, "Let's play again soon" and exits your app:

app.ask(`Guess a number`,
  ['I didn\'t hear a number', 'If you\'re still there, what\'s your guess?',
    'We can stop here. Let\'s play again soon.']);

Dynamic reprompts

You can receive an intent or Dialogflow event every time your app doesn't receive any input. This allows you to return a different response based on some logic, if necessary, and reprompt the user appropriately.

Dialogflow

You can create two types of no-input intents:

  • Normal intent - This method doesn't apply any contexts, so will be triggered when there isn't another, more contextual intent to trigger. This is useful for general reprompts that you want to apply in most cases.

  • Follow-up intent - Follow-up intents are enforced through Dialogflow contexts, ensuring reprompts are triggered only after certain turns of the conversation. This is useful for tailored reprompts that you want to apply to specific situations.

To handle no-input events:

  1. In the left navigation, click Intents.
  2. Create a normal intent or follow-up intent.

    • For normal intents: Click on the + icon by the Intent menu item.

    • For follow-up intents: Hover over the intent that you want to customize the no-input reprompt for and click on Add follow-up intent > custom. A new intent is created below the original intent.

  3. Click on the newly created intent to open the intent editor.

  4. Click the Events section and enter actions_intent_NO_INPUT into the Add event field.
  5. In the Actions section, enter an action name or use the one provided by default. For this example, we'll use no.input.

  6. Click Save.

  7. In the left navigation, click Integrations
  8. Choose Google Assistant and click UPDATE DRAFT, then TEST to make sure the changes are reflected in your app.

Whenever a no-input occurs for this intent, you can use your fulfillment to return an appropriate response or create one in Dialogflow. For example, here's some fulfillment code that uses the client library to handle a no-input intent.

    // a normal intent's action name
    const NO_INPUT_EVENT = 'no.input';

    ...

    function noInput (app) {
      if (app.getRepromptCount() === 0) {
        app.ask(`What was that?`);
      } else if (app.getRepromptCount() === 1) {
        app.ask(`Sorry I didn't catch that. Could you repeat yourself?`);
      } else if (app.isFinalReprompt()) {
        app.tell(`Okay let's try this again later.`);
      } 
    }

    let actionMap = new Map();

    ...

    actionMap.set(PROVIDE_GUESS_NO_INPUT_EVENT, provideGuessNoInput);
    actionMap.set(NO_INPUT_EVENT, noInput);
    app.handleRequest(actionMap);

Actions SDK

To handle no-input intents:

  1. In a conversations object inside your action package, declare that you want to receive the actions.intent.NO_INPUT intent whenever a user doesn't provide input.

    "conversations": {
      "conversationName": {
        "name": "conversationName",
        "url": "https://my.fulfillment.com/conversation",
        "in_dialog_intents": [
          {
            "name": "actions.intent.NO_INPUT"
          }
        ]
      }
    }
    
  2. When the Assistant doesn't receive any input from the user, you'll receive the no-input intent in the next request to your fulfillment. You can then process the intent and return an appropriate reprompt response. Here's an example:

    function noInput (app) {
      if (app.getRepromptCount() === 0) {
        app.ask(`What was that?`);
      } else if (app.getRepromptCount() === 1) {
        app.ask(`Sorry I didn't catch that. Could you repeat yourself?`);
      } else if (app.isFinalReprompt()) {
        app.tell(`Okay let's try this again later.`);
      } 
    }
    
    let actionMap = new Map();
    
    ...
    
    actionMap.set(app.StandardIntents.NO_INPUT, noInput);
    app.handleRequest(actionMap);