1

I have a simple question and answer skill. The problem I have is when i have the same answer to multiple questions - So, if i have a 5 question answer skill - and 3 of the answers are 'Yes' it won't advance to the next question because it would call question 1 because the Yes slot value is mapped question 1 intent.

Are there any examples how to avoid this? Or, maybe my approach is all wrong.

rmrrmr9
  • 11
  • 3

1 Answers1

1

I had this same problem in my "Who's on First?" baseball skit skill. The way to handle this is to keep track of which question was asked.

You can do this several ways, but I think that the easiest way is to pass a question # or id in the session. So for example, in my skill there is an exchange of 83 lines. I numbered these from 1 to 83, and pass that number in the session.

When the intent handler receives an intent that could be a response from one of multiple lines, the intent handler for that checks to see which line number was passed in the session to determine which is the next line.

Search on "alexa session" to find lots of blog articles and examples on doing this sort of thing. Here is a link to a BNR article about it.

Ron Lisle
  • 1,164
  • 6
  • 11
  • make sense - thx - do you know of an examples (git) you can point me too. - by the way i'm using python – rmrrmr9 Jul 13 '17 at 19:50
  • found a good example: here: https://stackoverflow.com/questions/43664060/alexa-flask-ask-yes-no-response-handling – rmrrmr9 Jul 13 '17 at 19:57
  • If you are using Python maybe take a look at this example code of mine. I implement a simple finite-state-machine where you can keep track of your questions as states and map intents such as "yes" to different responses. https://github.com/josepvalls/ask.py – Josep Valls Jul 17 '17 at 15:14