Search code examples
alexa-skills-kit

Creating a survey in amazon Alexa with open ended questions


I am trying to create a simple survey skill in Amazon Alexa where Alexa asks the user a question and they respond in any manner they feel like (open-ended). For example, if Alexa asks "Do you cook?", a user may respond in many ways such as "Yes I do cook", "My son does the cooking" etc.

The issue I am getting is that the questions can have similar responses so when I create an utterance in the Alexa dev console they overlap (utterance conflicts) and I am redirected to the error handler. (note each question has its own intent)

  1. Is there any other way I can go about creating a survey without using intents?
  2. Can I capture the full user response to a slot?

The reason being I want to store the user's response in a database.


Solution

  • Unfortunately, Alexa Skills aren't designed to do Speech To Text.

    When a user talks to a device, the request goes through multiple steps:

    1. Automated Speech Recognition > It does Speech To Text internally
    2. Natural Language Understanding (NLU) > Using Machine Learning, it will understand what the user want to do (Stop a skill, play music, switch on the light, ...)
    3. Depending of the context, if the NLU understand that the user is trying to respond to your skill (the interaction model match what the user is saying), it will send a POST request to your skill. But it will not send you the Speech To Text.

    Documentation

    Although, the intent AMAZON.SearchQuery will do the job but you will have to use a prefix: My answer is {query} and not directly {query} because all requests will be redirected to this intent otherwise. It will not look like a good & smooth user experience.