By default, Google Assistant immediately exits the app when a user says things like "exit", "cancel", or "stop". If you want to return a last response, you need to override this default behavior. Read on to learn how it works.
- Create a StopIntent or CancelIntent
Jovo comes with a default
'END' handler that lets you clean up some data and send a final response after a person wants to exit your voice app. For Alexa Skills, the
SessionEnded requests are mapped to
END by default. Learn more here: Routing > 'END' Intent.
Google Assistant, however, doesn't offer this behavior by default, but rather exits the conversation by just playing an earcon. Read more here: Actions on Google Documentation > Conversation Exits.
Alexa already comes with a required
AMAZON.StopIntent that is triggered when a user wants to stop the conversation. For Google Assistant, we need to add a new intent with a specific event
actions_intent_CANCEL to our Dialogflow Agent. Any incoming request with this event will then be mapped to the
'END' intent in your Jovo app.
You can call it whatever you want, for example
CancelIntent (notice that there is no difference on Google Assistant between "stop" and "cancel" in comparison to
There are two alternatives to add the intent:
You can add it by going to the Dialogflow Console and creating a new intent. Select "Events" and type in
actions_intent_CANCEL. No need to add any training phrases.
Don't forget to scroll all the way down and enable webhook fulfillment:
You can now save the intent and train the agent.
If you want to maintain your language model in your code base (recommended), you can choose different strategies.
For example, you can add the intent to the
dialogflow specific block in your language model file:
Alternatively, you can add an intent to the general Jovo intents with specific blocks for both
Learn more about how to deploy your Dialogflow Agent here: Deploy a Dialogflow Agent with the Jovo CLI.