How do you take raw voice input from an Alexa device

Question:

I have created an Alexa skill which I can successfully interact with using various intents. However, these are fixed answers/inputs. I would like to receive raw input from the Alexa device into my Amazon AWS Lambda function. For example, if I had the Alexa device ask ‘What is your username’, and the person responded ‘Allie123’, how would I receive ‘Allie123’ as a string in my Lambda function. Thanks.

Asked By: ba126

||

Answers:

Use AMAZON.SearchQuery to capture arbitrary input from the user. There are limitations but this is the correct tool for the job. There are a few ways to use it:

  1. regular intent with carrier phrase, one SearchQuery slot and no other slots. This works fine but requires the user to say the carrier phrase.

  2. as for #1 but with an ‘whitespace only’ carrier phrase. This will trigger on anything that doesn’t match your other intents. The precedence rules in Alexa fortunately ensure that it will not match if a ‘normal’ intent can match. This can be interesting approach for prototypes/development skills but most likely will not pass certification due to privacy concerns.

  3. slot-elicitation on a SearchQuery slot. This can only be used when you have issued a prompt such as "what is your full name?" but it will always match the next utterance and doesn’t require carrier phrase. If you can ask the user a question before they provide input then this is your best bet.

More info: https://developer.amazon.com/blogs/alexa/post/a2716002-0f50-4587-b038-31ce631c0c07/enhance-speech-recognition-of-your-alexa-skills-with-phrase-slots-and-amazon-searchquery

Some discussion of the various other options can be found at: https://developer.amazon.com/blogs/alexa/post/a3142024-75cf-46bb-924a-0ab3524a5c07/5-techniques-to-replace-amazon-literal-and-improve-skill-accuracy

Answered By: Mike Liddell