Conversation Exits

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

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

By default, the Assistant exits your conversation 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 conversation exit requests is 2 seconds; if no response is received, the conversation will end with the default exit earcon. If your custom cancel response fails (due to exceeding character limit, improper response type, etc) the conversation will also end with the default exit earcon.

Dialogflow

To receive conversation 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. Either specify a response under Response or set up your own response for this intent in your webhook code.
  5. Enable Set this intent as end of conversation.
  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 project.

When a user requests an conversation 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 conversation 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 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.`);
});