How can I trigger Alexa intent with clicks rather than voice?

混江龙づ霸主 提交于 2019-12-24 10:37:48

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/55017008/how-can-i-trigger-alexa-intent-with-clicks-rather-than-voice

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!