I am trying to build an Alexa skill set and would like to make use of slots.
handle(handlerInput);
const request =
handlerInput.requestEnvelope.request;
const responseBuilder =
handlerInput.responseBuilder;
let sessionAttributes = handlerInput.attributesManager.getSessionAttributes();
let say = "";
let slotStatus = "";
let resolvedSlot;
let slotValues = getSlotValues(
request.intent.slots
);
// getSlotValues returns .heardAs, .resolved, and .isValidated for each slot, according to request slot status codes ER_SUCCESS_MATCH, ER_SUCCESS_NO_MATCH, or traditional simple request slot without resolutions
// console.log('***** slotValues: ' + JSON.stringify(slotValues, null, 2));
// SLOT: carvariant
if (slotValues && slotValues.carvariant) {
say =
"Good Choice! For an {carvariant}, I would suggest Kia Seltos";
} else {
say =
"Sorry! We do not have that category of car available.";
}
where {carvariant} is the slot that I created having values as "sedan,SUV,hatchback" but it return nothing.
I also tried say = 'Good Choice! For an ${slotValues.carvariant.heardAs}, I would suggest Kia Seltos'
but it didn't pick the values from slots created.