You can enable ANY handler you've coded to handle the YesIntent by adding it as a true condition in the canHandle
for the handler and you can match it with session values to make it possible for different handlers to be used depending on the context.
Here's an example.
let attributes = await handlerInput.attributesManager.getSessionAttributes();
return ((Alexa.getRequestType(handlerInput.requestEnvelope) === 'IntentRequest'
&& Alexa.getIntentName(handlerInput.requestEnvelope) === 'CityIntent')
|| (Alexa.getRequestType(handlerInput.requestEnvelope) === 'IntentRequest' &&
Alexa.getIntentName(handlerInput.requestEnvelope) === 'AMAZON.YesIntent' &&
attributes.last === "City"));
So if they explicitly hit the CityIntent, or they hit it before (and you stored that in attributes.last
) but answered "Yes," it gets triggered.
Using the FallbackIntent when you know they might answer "yes" is an anti-pattern. It's intended to be used when they say something you don't expect. You expect "yes," so proactively handle it.