Search code examples
alexa-skills-kitalexa-voice-service

Alexa Intent Schema: Random input being identified as intents


I have two intents that use the same slot types. However, if the input is a random string, Alexa automatically identifies an intent in its JSON request even though it is not part of the utterances. For example, in the example below, if the user input was 'bla bla bla', GetAccountBalance is identified as the intent with no slot value even though it is not part of provided utterances.

What is the way to error-check for these cases and what is the best practice to avoid cases like this when developing the intent schema? Is there a way to create an intent that can handle all random inputs?

Example Schema:

{
  "intents": [
    {
      "intent": "GetAccountBalance",
      "slots": [
        {
          "name": "AccountType",
          "type": "ACCOUNT_TYPE"
        }
      ]
    },
    {
      "intent": "GetAccountNumber",
      "slots": [
        {
          "name": "AccountType",
          "type": "ACCOUNT_TYPE"
        }
      ]
    }
  ]
}

Utterances:

GetAccountBalance what is my account balance for {AccountType} Account
GetAccountBalance what is my balance for {AccountType} Account
GetAccountBalance what is the balance for my {AccountType} Account
GetAccountBalance what is {AccountType} account balance
GetAccountBalance what is my account balance
GetAccountBalance what is account balance
GetAccountBalance what is the account balance
GetAccountBalance what is account balance

GetAccountNumber what is my account number for {AccountType} Account
GetAccountNumber what is my number for {AccountType} Account
GetAccountNumber what is the number for my {AccountType} Account
GetAccountNumber what is {AccountType} account number
GetAccountNumber what is my account number
GetAccountNumber what is account number
GetAccountNumber what is the account number
GetAccountNumber what is account number

Solution

  • As per the documentation:

    The AMAZON.FallbackIntent (available in English (US) only) is triggered when the user's spoken input does not match any of the other intents in the skill. AMAZON.FallbackIntent is matched to an automatically-generated out-of-domain model.

    Code snippet:

    'AMAZON.FallbackIntent': function (intent, session, response) {
        response.ask("Optimus Prime didn't get that one....","");
    }