Prisoner
Prisoner

Reputation: 50701

Get Google Assistant Action to respond to "Quit" or "Cancel"

I've tried to follow the documentation about App Exit handling, but it doesn't seem to be working correctly. (See the screen shot of my Intent below).

When I do it this way, it seems to resort to my Default Fallback Intent, although it does indicate that the resolvedQuery is actions_intent_CANCEL, which should be correct. (See the JSON body below.)

Am I doing something wrong, or is the documentation wrong?

Intent trying to handle it:

enter image description here

JSON Body:


{
    "originalRequest": {
        "source": "google",
        "version": "2",
        "data": {
            "isInSandbox": true,
            "surface": {
                "capabilities": [
                    {
                        "name": "actions.capability.AUDIO_OUTPUT"
                    },
                    {
                        "name": "actions.capability.SCREEN_OUTPUT"
                    }
                ]
            },
            "inputs": [
                {
                    "rawInputs": [
                        {}
                    ],
                    "intent": "actions.intent.CANCEL"
                }
            ],
            "user": {
                "locale": "en-US",
                "userId": "AETml1QP6omTPEXBfrOBdvNlwHxY"
            },
            "conversation": {
                "conversationId": "1509314271837",
                "type": "ACTIVE",
                "conversationToken": "[]"
            },
            "availableSurfaces": [
                {
                    "capabilities": [
                        {
                            "name": "actions.capability.AUDIO_OUTPUT"
                        },
                        {
                            "name": "actions.capability.SCREEN_OUTPUT"
                        }
                    ]
                }
            ]
        }
    },
    "id": "bbd363aa-f555-4543-a748-294751194fa9",
    "timestamp": "2017-10-29T21:58:00.691Z",
    "lang": "en-us",
    "result": {
        "source": "agent",
        "resolvedQuery": "actions_intent_CANCEL",
        "speech": "",
        "action": "input.unknown",
        "actionIncomplete": false,
        "parameters": {},
        "contexts": [
            {
                "name": "actions_intent_cancel",
                "parameters": {},
                "lifespan": 0
            },
            {
                "name": "actions_capability_screen_output",
                "parameters": {},
                "lifespan": 0
            },
            {
                "name": "actions_capability_audio_output",
                "parameters": {},
                "lifespan": 0
            }
        ],
        "metadata": {
            "intentId": "25f6e14b-a92c-479b-8943-76c4b6914579",
            "webhookUsed": "true",
            "webhookForSlotFillingUsed": "false",
            "nluResponseTime": 2,
            "intentName": "Default Fallback Intent"
        },
        "fulfillment": {
            "speech": "I'm sorry. I didn't quite grasp what you just said.",
            "messages": [
                {
                    "type": 0,
                    "id": "535c3b80-f13d-4b61-8c1d-bb58fa3f5e44",
                    "speech": "I'm a bit confused by that last part."
                }
            ]
        },
        "score": 1
    },
    "status": {
        "code": 200,
        "errorType": "success"
    },
    "sessionId": "1509314271837"
}

Upvotes: 3

Views: 1303

Answers (2)

SysCoder
SysCoder

Reputation: 764

In addition to the steps in the documentation, I found that I had to tell the simulator to update to the most recent version!

Here is my video outlining the steps I took. https://www.youtube.com/watch?v=ZvZDokjhUIY

enter image description here

enter image description here

Upvotes: 2

Prisoner
Prisoner

Reputation: 50701

Although this isn't what the documentation suggests, I've found a workaround that seems to be correct.

Since there doesn't seem to be any spoken input registered, it looks like it would make sense for a Fallback Intent. Since Fallback Intents other than the default one require a Context, and not just an Event, and it looks like the actions_intent_cancel context is created, it seems reasonable to use it.

A Fallback Intent for this might look something like this:

enter image description here

Upvotes: 1

Related Questions