Search code examples
alexa-skills-kitalexa-slot

Can I answer differently if get different slot value in same intent, AWS Alexa


What I am trying to achieve: I am trying to answer differently if a get differently value for the same slot

Example: I have made an intent with a slot having months of the year. so when user says specific month i.e. March then i want to tell all the events happened in the March only.

What I have tried: I have tried making an intent with a slot and on the back end i am able to get the name the month that slot got filled with.

Please help!!


Solution

  • A slot can carry a number of values. Amazon even has a predefined month slot type.

    Here's part of an Alexa beginner tutorial that asks for your birthday. It should help you understand this.

    https://developer.amazon.com/en-US/alexa/alexa-skills-kit/get-deeper/tutorials-code-samples/build-an-engaging-alexa-skill/module-4

    Updating

    If you're needing to understand how to return different responses based on the slot value, your best bet would be to learn how to use a switch statement.

    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch