Navigation
Details about the Navigation user journey
The onNavigation
callback
onNavigation
callbackWhen the Assistant detects that the user is trying to navigate to various parts of the app, it invokes the callback associated with the Navigation user journey. The callback looks like this:
When this callback is invoked, the app is expected to:
Use the
NavigationInfo
parameter to examine the target of the user's navigationOpen the corresponding page/
Activity
using the target fieldFinally, return the
AppState
andCondition
that the app transitioned into.
For example, for a given onNavigation
callback invocation, if the user asked for viewing the cart and if the app can navigate to that page successfully, it sets the success condition and returns the NAVIGATION app state.
Sample Utterances that could trigger Navigation
The following are some examples of commands that could trigger this journey
"go to my bookings"
"take me home"
NavigationInfo
Parameter
NavigationInfo
ParameterThe parameterNavigationInfo
contains the breakdown of the original navigation request. It has the following structure:
Supported AppState
s
AppState
sThe following AppState
s are supported.
NAVIGATION_COMPLETE : To be returned when the app handles the navigation request
UNSUPPORTED : To be returned when the app is not ready to handle navigation yet. The Assistant will speak out an appropriate prompt to the user.
The Slang Retail Assistant provides a special AppState
'WAITING' (WaitingAppState)
that is common across all UserJourney
types for completing asynchronous operations within the callback. Refer to the Asynchronous Action Handling section for details of how to deal with asynchronous operations.
Supported Condition
s
Condition
sThe following Condition
s are supported for each of the AppState
s supported by the Assistant
App State
App State Condition
Description
NAVIGATION_COMPLETE
setSuccess()
setNeedTarget()
setFailure()
The navigation was successful
The navigation target is not valid
There was a failure while navigating
Assistant Prompts
Based on the App State and the Condition that was set, the Assistant will speak out an appropriate message to the user. You can examine the default set of prompts configured for the Assistant through the Console and also customize it to your needs. Refer to the Customizing the Assistant section for details.
Last updated