I'm trying to migrate my skill to sdk V2 for Node.js. (It is a total re-write) . In SDK V1 one we had the state handlers so you can have different states and this states could have sub/internal handlers.
So you have a general yes/no handler and you may have another one which works in only a specific state . it is explained here in the V1 docs ;
I've tried to implement this with session state and try to do a check in canHandle method, but could not get it working as I have in the V1.
In V1, as long as you are in that state handler, it does not matter what user says it will always try to satisfy with the handlers you have/defined in that state handler .
In V2, if user say something else, it will match with another intent and you need to check your state in every intent handler to get correct state and do the correct thing.
example , in v1 :
User : - I need to report a medication adherence.
Alexa : - Alexa will read first thing in the user's medication pilbox and start in "HandleMedicationState" by waiting for a Yes or No
User: Yes, No or Skip (this all 3 handlers defined in the state handler.)
Alexa : read next one... till all of them reported or skipped.
So does anyone can advise me the correct way of doing this in V2 ?