2

I am working on a flask app that links to Alexa skills. I am trying to building a capability when a user click on some content (e.g. notifications), Alexa asks if the user wish to proceed, if the user says 'yes', then Alexa takes the user to the relevant webpage.

My question is, is it possible to trigger Alexa intent with clicks on the website content instead voice? My understanding that intent can only be activated through voice.

Any thoughts will be much appreciated.

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470

1 Answers1

3

As you say the intent is triggered by voice. A relatively easy way to do it would be:

Generate the audio file expressing the intent using polly tool. E.g. "play my song" https://docs.aws.amazon.com/polly/latest/dg/API_SynthesizeSpeech.html

Whenever the user clicks on the web link, invoke the intent using the PostContent API. Basically pretending the user said it.

An example of invocation would be:

aws lex-runtime post-content  --bot-name yourBot --bot-alias \"\\$LATEST\"  --user-id youruserid--content-type \"audio/l16; rate=16000; channels=1\"  --input-stream request.wav answer.mp3

where yourBot is your Bot name and request.wav is the audio file previously generated with polly. You will get the audio answer in the file answer.mp3

Drawback is you need to use lex/lambda for this, not just flask... Hope it helped! Ester

  • but how would i trigger it as a particular alexa device, so that that alexa device would speak the 'answer'. For example, to trigger a 'skill' when some condition happens, to cause alexa to speak (unprompte) and ask the user something. – AwokeKnowing Aug 17 '22 at 19:26
  • You could process the answer file mp3, and transcript it to text using google or amazon tools. From there you can either programmatically process it or play it out loud....depends on the logic you want – Ester Gonzalez De Langarica Aug 19 '22 at 07:48
  • I mean, like i have a camera in a room, and when I detect a person, I want to trigger an alexa skill eg "alexa open 'we have a visitor'", so that when a person walks into the room, alexa says "welcome, how was your day?". ie just trigger as though the person had said "alexa open 'we have a visitor'" – AwokeKnowing Aug 23 '22 at 19:57