Search code examples
actions-on-google

Handle No Match input with custom logic in Confirmation Intent using Actions SDK


When I use the Confirmation Helper Intent on an Actions SDK project, it works as it's supposed to. But I want to handle the case when the user's input doesn't mean either yes or no (a No Match situation). Currently Assistant automatically re-prompts the user in this situation.

Actions SDK provides the user's actual input when a confirmation is granted or denied. But is there any way to know what the user said in a No Match situation?

For example, let's say, in a Confirmation prompt, the user says: "I just need some eggs. Just give me some eggs". This would cause Assistant to show the same prompt to the user again. It happens automatically and I have no way of accessing what the user actually said. If I want to do something when the user says "I just need some eggs" I can't do it because I can't access what the user is saying. Moreover, I haven't seen any Intent getting fired in this situation.

So, how can I handle No Match situations with custom logic instead of giving the default re-prompt to the user?


Solution

  • The easiest way is to not use the confirmation helper and just create Intents that handle "yes" or "no" equivalents yourself.