Manage the Skill Session and Session Attributes
const sessionAttributes = handlerInput.attributesManager.getSessionAttributes();
const favoriteColor = getSlotValue(
handlerInput.requestEnvelope,
"favoriteColor"
);
sessionAttributes.favoriteColor = favoriteColor;
handlerInput.attributesManager.setSessionAttributes(sessionAttributes);
const sessionAttributes = handlerInput.attributesManager.getSessionAttributes();
if (sessionAttributes.favoriteColor) {
//do something
}
How to Use Session Attributes in Your Alexa Skill to Enhance the Voice Experience
Alexa Skill Recipe: Using Session Attributes to Enable Repeat Responses