How do I handle 'Yes'/'No' responses from the user in Custom Skill?
Asked Answered
C

2

6

I am trying to build an alexa custom skill. I am facing an issue where I am trying to get Yes/No responses from the user for a question which the skill asks the user.

Alexa: Would you like to know the rules of the game?
User: <Can respond either Yes or No>

Based on the user response I would like to perform a specific action.

Here is my intent schema:

{
    "intents": [
    {
        "intent": "AMAZON.StopIntent"
    },
    {
        "intent": "AMAZON.CancelIntent"
    },
    {
        "intent": "AMAZON.HelpIntent"
    },
    {
        "intent": "StartGame"
    },
    {
        "intent": "GetRules"
    }
  ]
}

Here are my sample utterances:

StartGame Begin the game
StartGame Start the game

GetRules What are the rules
GetRules Get the rules
GetRules Tell me the rules
GetRules Tell me the rules again

The question the skill asks the user is below:

Welcome to the game. Would you like me to tell you the rules?

Whenever I say "Yes", the StartGame intent is what is being triggered. (Same is the case for "No"). Alexa picks the intent as StartGame always. What is the best way to invoke "GetRules" intent. I want the user to just say Yes/No and not say "Get the rules".

Please let me know if this has been already answered/more information is needed.

Carving answered 20/2, 2017 at 4:57 Comment(0)
P
5

You need to use AMAZON.YesIntent and AMAZON.NoIntent.

You can read about them here:.

Standard Built-in Intents. https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/built-in-intent-ref/standard-intents

Paracasein answered 20/2, 2017 at 14:37 Comment(2)
the link seems brokenVeronikaveronike
The link is here: developer.amazon.com/en-US/docs/alexa/custom-skills/…Au
M
0

Please add below code in interaction model.

{
    "name": "AMAZON.NoIntent",
    "samples": []
},
{
    "name": "AMAZON.YesIntent",
    "samples": []
}

And provide your business logic for yes/no in your lambda.

'AMAZON.YesIntent': function () {
    //business code
},
'AMAZON.NoIntent': function () {
    //business code
}
Marquesan answered 10/7, 2018 at 9:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.