By default, the Snips platform terminates the dialogue session when an intent is not recognized. You may want to handle differently the behaviour of your assistant when this occurs. There are two strategies you could use:
Fetch the error message on dialogue termination
Overwrite the default behaviour when starting a session
This article will guide you through the necessary steps to apply the proposed strategies.
You may want to build or refresh your understanding on how sessions work on the platform before continuing by:
Reading the Sessions article
As mentioned before, the default behaviour of the Snips platform is to terminate the dialogue session once an intent not recognized is detected. The termination type that causes the session to end can be accessed if you are subscribed to the Session Ended MQTT topic.
You can take advantage of the way this is handled by doing the following in your action code:
Subscribe to Session Ended MQTT topic
Parse Session Ended messages and access the termination key in the payload
intentNotRecognized is present on the value of the termination key, handle a new interaction with the user. You could start a new session asking the user to reiterate their request or whatever other strategy that suits your context.
The default setup of the platform when starting a session is to not to send a message to the platform if an intent is not recognized. Luckily, this behaviour can be overwritten so the platform sends messages when an intent is not recognized.
To overwrite the default behaviour you need to: 1. Set the flag
sendIntentNotRecognized to true when starting or continuing a session programmatically with action code using Start Session or Continue Session respectively. 2. Be subscribed to the Intent Not Recognized MQTT topic to start listening for messages. 3. Once a new Intent Not Recognized message is received, handle it the way you prefer.
Step 1 could be executed right after a push-to-talk action has been performed.