How to implement a next intent in alexa

吃可爱长大的小学妹 提交于 2019-12-06 16:09:46

Alexa SDK provides you ability to keep the state in session attributes. For Node.js it's this.attributes. You can read more about here in Skill State Management section.

You can keep the current step in that attribute. Once your skill is started you can set the current step to "first" (or 1, or whatever).

Once the AMAZON.NextIntent is triggered, you check the state of the attribute and decide which audio file to play next.

Something like:

if (this.attribute['currentStep'] == 1) {
  playSound('a2')
}

You will be able to even persist those attributes in DynamoDB later on. Check that section.

In case you are not using Node.js for that, I'm pretty sure it is supported by other languages.

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