How the Unhandled Intent Works

by Kaan Kilic on Sep 10, 2018

Introduction

The Unhandled intent is used to catch incoming intens, which can't be found inside your handler. If you've created a Dialogflow agent before you might have seen the Default Fallback Intent which is automatically mapped to the Unhandled intent as well.

Unhandled Intent Inside a State

The Jovo Framework will look for the requested intent inside the current state first. If it can't find the intent there, it will go on searching for intent in the next outer scope and so on. You can stop that process using the Unhandled intent inside a state.

Let's say the incoming request contains a PlayIntent, but we're currently in the DoNotPlayState which does not have a PlayIntent, but globally there is one. Without the Unhandled state, the system would jump to the global scope and map the request to the PlayIntent. But with the Unhandled intent it would catch the request and remain in the current state:

There is also the possiblity to have nested states in which case the intent will be mapped to the first Unhandled intent it comes across:

Global Unhandled Intent

The global Unhandled intent is the last line of defense. Any requested intent, which can't be found in any of the states, which also do not have Unhandled intents themselves, will be mapped to the global Unhandled intent.

Let's say the requested intent is called PlayIntent, but we don't have that intent neither in one of our states nor in the global scope. In that case the intent will be mapped to the global Unhandled intent, because there's also no Unhandled intent in one of the states to catch it before that.

Intents to Skip Unhandled

The Jovo framework also provides the possiblity to define intents, which won't be mapped to the Unhandled intent no matter what. It allows you to make sure that the intent will be always caught globally.

You can define these intents inside your app's config, config.js the following way:

Let's say we have the configuration above and the app is currently inside StateOne and the HelpIntent was requested, but that intent was not defined inside StateOne. Instead of the request being mapped to the Unhandled intent inside StateOne, the global HelpIntent will be used.


Kaan Kilic

Technical Content Marketing Associate at Jovo

Comments and Questions

Any specific questions? Just drop them below or join the Jovo Community Forum.

Join Our Newsletter

Be the first to get our free tutorials, courses, and other resources for voice app developers.