1

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.

Atul Singh
  • 11
  • 3
  • what is Car variant suppose to say? Can you share your JSON value similar to [1]: https://stackoverflow.com/questions/34887451/getting-an-alexa-slot-value-out-of-an-intent – Zachary Blumstein Nov 27 '19 at 23:20
  • Car variant should return one of the values from the custom slot created. `"types": [ { "name": "carvariant", "values": [ { "name": { "value": "Hatchback" } }, { "name": { "value": "Sedan" } }, { "name": { "value": "SUV" } } ] } ]` – Atul Singh Nov 28 '19 at 04:15

0 Answers0