App Exits

Whenever users want to exit your app mid-conversation, they can say things like:

  • "exit"
  • "cancel"
  • "stop"
  • "nevermind"
  • "goodbye"

By default, the Assistant exits your app and plays an earcon. To override this behavior, you can opt-in to receiving one last request that you can use to cleanup your fulfillment logic and respond to the user one last time. Your final response must be a single simple response with a 60-character limit on its textToSpeech and displayText values.

The maximum execution time allowed for app exit requests is 2 seconds; if no response is received, the app will exit out with the default exit earcon. If your app's custom cancel response fails (due to exceeding character limit, improper response type, etc) the app will also exit out with the default exit earcon.

Dialogflow

To receive app exit events:

  1. In the left navigation, click the + icon by the Intents menu item.
  2. Give the intent a name and click on the Events section.
  3. Enter actions_intent_CANCEL in the Add event field.
  4. In the Actions section, enter an action name. For this example, we'll use say.bye.
  5. Specify a response in Dialogflow's Response section or return one in your fulfillment code.
  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.

When a user requests an app exit, the intent you created is triggered and your response is returned to the user. For example, here's some fulfillment code that uses the client library to handle a cancel intent and return a response:

app.intent('say.bye', (conv) => {
  conv.close(`Okay, let's try this again later.`);
});

Actions SDK

To receive app exit intents:

  1. In a conversations object inside your action package, declare that you want to receive the actions.intent.CANCEL intent whenever a user wants to exit your app mid-conversation:

    "conversations": {
      "myConversation": {
        "name": "myConversation",
        "url": "https://my.fullfillment.com/conversation",
        "inDialogIntents": [
          {
            "name": "actions.intent.CANCEL"
          }
        ]
      }
    }
    
  2. When you receive a request with the actions.intent.CANCEL intent, clean up any fulfillment logic that you'd like and return an appropriate exit phrase to the user. For example, here's some fulfillment code that uses the client library to handle a cancel intent:

app.intent('actions.intent.CANCEL', (conv) => {
  conv.close(`Okay, let's try this again later.`);
});