Learn
Nice work, you just learned how you can use synonyms to allow a user to speak in a way that makes sense for them, while providing a means for your skill to still correctly interpret the user’s input.
Let’s review what we learned:
- With Alexa Skills Kit’s Entity Resolution, we can create synonyms for our slot values, so that we can receive consistent data in our code, but still allow a user to speak in the way that makes sense for them.
- Since ER provides you the resolved value, you avoid the need to write complicated code to handle various synonyms, thereby making your code easier to write and maintain.
- The JSON request sent to your Lambda function includes some important information, including the synonym Alexa heard, the status code of the resolution, and the resolved value.
- We can access the synonym using this.event.request.intent.slots.yourSlotName.value
- We can access the status code usingthis.event.request.intent.slots.yourSlotName.resolutions.resolutionsPerAuthority[0].status.code
- We can access the resolved value using
wherethis.event.request.intent.slots.yourSlotName.resolutions.resolutionsPerAuthority[0].values[0].value.nameyourSlotName
is the desired slot.
More Alexa Resources
- For more Alexa news, subscribe to the Alexa developer newsletter to stay up-to-date on new features, tutorials, and events.
- Alexa Developer Forums
- Alexa Voice Design Guide
- Alexa code samples and templates on GitHub
- AlexaDevs on Twitter
Instructions
Watch the video to the right. Notice how Alexa responds to the user’s request with the request value (large
), not the resolved value (big
).
Take this course for free
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.