Skip to Content
Learn
Use Synonyms in Lambda Functions
Review

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 using
    this.event.request.intent.slots.yourSlotName.resolutions.resolutionsPerAuthority[0].status.code
  • We can access the resolved value using
    this.event.request.intent.slots.yourSlotName.resolutions.resolutionsPerAuthority[0].values[0].value.name
    where yourSlotName is the desired slot.

More Alexa Resources

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).

Folder Icon

Take this course for free

Already have an account?