Search code examples
node.jsaws-lambdaalexa-skills-kit

How do I get a users response in Lambda


How do I get the users response from a question asked to the user from the slot and display a response through code?


Example:

Alexa Skill: What is your name?

User: My Name is Yuri Alves

Alexa Skill: Hello Yuri Alves


Solution

  • You can get the slot value by following 2 methods in Node.js.

    OLD Method

    let slot_value = this.event.request.intent.slots.slot_name.value;

    NEW Method

    let slot_value = handlerInput.requestEnvelope.request.intent.slots.slot_name.value;

    You can easily output this slot value in responseBuilder.