天道酬勤,学无止境

alexa-skills-kit

How to make Alexa countdown in seconds

I want to be able to have alexa (audibly) countdown 15 seconds in my skill. I know I can just <break time="15s" /> in SSML. But that isn't audible. I also know I can just do: 15<break time="1s" /> 14<break time="1s" /> or better yet (to account for the time it takes to say the number) 15<break time="0.85s" /> 14<break time="0.85s" /> But that's going to be a ton of repeated code if I do this many times over. So I'm probably going to write a function that takes in a number and a number of seconds, and produces an SSML countdown in that interval. Before I do that, however, I was wondering if

2022-01-18 09:55:48    分类:问答    amazon-web-services   alexa   alexa-skills-kit   alexa-skill   alexa-voice-service

"Catch-all" for Alexa Skills Kit input not in defined intent

I am building an Alexa app that needs to be able to process answers to a question. I have an SkipIntent intent that has sample utterances to skip a question. I want to build an AnswerIntent that can take answers that can be anything and process them against the correct answer. I tried using an Amazon.LITERAL type for this with a few samples as such (from this question: How to accept the Free form text as input to Amazon Skill Kit?): AnswerIntent {bottle|Answer} AnswerIntent is it {bottle|Answer} AnswerIntent is it a {bottle|Answer} AnswerIntent is it an {bottle|Answer} AnswerIntent a {bottle

2022-01-16 18:47:57    分类:问答    alexa-skills-kit

Alexa Dialog Model Step 和 dialogState 从未在 COMPLETED(Alexa Dialog Model Step and dialogState is never in COMPLETED)

问题 我正在使用 PHP 端点实现 Alexa 对话模型。 我使用了 Alexa 文档(https://developer.amazon.com/fr/docs/custom-skills/dialog-interface-reference.html) 这是我的例子: 我的技能: 请求意图话语:在卧室里添加一个 {obj} 插槽:{obj} / 插槽填充 短语: 我:Alexa,在卧室里添加一个对象 Alexa:你想在卧室里添加什么物品? 我:我想在卧室里加一辆汽车 Alexa:你想在卧室里加一辆车吗? 我可以 步骤1: DialogState 已启动我使用 ElicitSlot 设置 {obj} 插槽 第2步: 对话状态为 IN_PROGRESS。 我使用 ConfirmIntent 要求用户确认 第三步: 用户说是/否 ConfirmIntent 现在设置为 CONFIRMED/DENIED 但仍处于 IN_PROGRESS dialogState 应该是 COMPLETED 因为我设置了我所有的 slot 和 intent 值对吗? 那么为什么不应该在这里工作呢? 提前致谢 回答1 您的dialogState未COMPLETE的原因是因为您使用的是Dialog.ElicitSlot指令。 COMPLETED状态仅在您使用Dialog.Delegate指令时才有可能。

2022-01-15 19:01:47    分类:技术分享    alexa   alexa-skills-kit   alexa-skill   alexa-slot

从 promise.then() 方法返回 handler.ResponseBuilder(Returning handler.ResponseBuilder from promise.then() method)

问题 在我的 Alexa 技能的意图处理程序之一中,一旦我的承诺得到解决,我必须返回响应。 代码如下所示: var rcvPromise = receiveMsgQ(); rcvPromise.then(function(speechText) { console.log('rcv Promise resolved with ',speechText); return handlerInput.responseBuilder .speak(speechText) .withSimpleCard('skill_name', speechText) .withShouldEndSession(false) .getResponse(); }); 技能返回错误消息,没有关于错误的其他详细信息。 有没有办法解决这个问题? PS:我需要使用 promise,因为receiveMsgQ()是异步函数调用。 回答1 您看到的错误是因为 NodeJS 和 Alexa SDK 是异步的。 正如您可以从 Alexa SDK 代码中读取的那样,它会调用您的请求处理程序并期望返回一个 Promise。 在您的示例中,由于您的代码在调用rcvPromise.then后没有显式返回任何内容,因此会返回一个空响应,并且 SDK 会向 Alexa 发送一个空响应,从而导致错误。 当您的then()函数将被执行时

2022-01-15 14:58:07    分类:技术分享    node.js   alexa   alexa-skills-kit   alexa-skill

Amazon Alexa 中帐户链接的示例 python 代码(Sample python code for Account Linking in Amazon Alexa)

问题 我在哪里可以找到 Amazon Alexa 中帐户链接的示例 Python 代码。 我只能在这里获得文档。 https://developer.amazon.com/docs/account-linking/understand-account-linking.html 请帮我 !! 回答1 帐户链接对所有语言的工作方式都相同,您应该熟悉OAuth2以在开发人员门户中配置帐户链接。 用户可以通过两种方式关联账户: 从 Alexa 应用程序中的技能详细信息卡中,同时启用该技能。 在发出需要身份验证的请求后,从 Alexa 应用程序中的链接帐户卡。 当您将帐户与您的技能相关联时,该技能的每个后续请求都将包含一个访问令牌。 然后,您可以使用此accessToken获取关联帐户的关联数据。 "session": { "new": true, "sessionId": "amzn1.echo-api.session.xxxxxxxxxxx", "application": { "applicationId": "amzn1.ask.skill.xxxxxxxxxx" }, "user": { "userId": "amzn1.ask.account.xxxxxxx", "accessToken": "xxxxxxxxxxxxxx" 对于经过身份验证的用例

2022-01-15 14:22:43    分类:技术分享    python   alexa   alexa-skills-kit   ask-sdk

Alexa Skills Kit 的 AudioPlayer“PlaybackNearlyFinished”请求,不工作(AudioPlayer "PlaybackNearlyFinished" Request of Alexa Skills Kit, Not Working)

问题 我编写了一个 Alexa Skill,它使用 Lambda 函数从给定的 URL 播放独特的音频。 名为“PlayAudio”的 Intent 正在工作并播放我们 JSON 格式 API 中的第一个音频项目。 名为“PlaybackNearlyFinished”的 Intent 不起作用,也就是不播放我正在喂它的音频文件。 任何人都可以破解为什么这不起作用? 这是我的 Lambda 函数的一部分,其中包含两个 Intent: Fact.prototype.intentHandlers = { "PlayAudio": function (event, context, response) { fetchEnseParse("/latest", function(body) { if(body == "error") { } else { var directives = body.enses.map(function(ense) { var a = ense[1].fileUrl; return { 'playBehavior': 'REPLACE_ALL', 'audioItem': { 'stream': { 'url': 'https://s3.amazonaws.com/media.ense.nyc/enses/2017_01_13T16_57_20.190Z

2022-01-14 11:10:24    分类:技术分享    aws-lambda   alexa   alexa-skills-kit

Sample python code for Account Linking in Amazon Alexa

Where can i find the sample Python code for Account linking in Amazon Alexa. I was only able to get the documentation here. https://developer.amazon.com/docs/account-linking/understand-account-linking.html Please help me !!

2022-01-14 05:49:41    分类:问答    python   alexa   alexa-skills-kit   ask-sdk

Alexa Dialog Model Step and dialogState is never in COMPLETED

I'm implementing an Alexa Dialog Model with an PHP Endpoint. I used the Alexa doc (https://developer.amazon.com/fr/docs/custom-skills/dialog-interface-reference.html) Here is my example: My skill: RequestIntent Utterance : add an {obj} in the bedroom Slots : {obj} / Slot Filling Phrase: Me : Alexa, Add an object in the bedroom Alexa : What object do you want to add in bedroom ? Me : I would like to add a cars in the bedroom Alexa : You want to add a car in the bedroom ? Me : Yes STEP1: DialogState is STARTED I use ElicitSlot to set the {obj} slot STEP2: dialogState is IN_PROGRESS. I use

2022-01-13 07:53:09    分类:问答    alexa   alexa-skills-kit   alexa-skill   alexa-slot

Returning handler.ResponseBuilder from promise.then() method

In one of the intent handler for my Alexa skill I have to return response once my promise is resolved. Code looks like this : var rcvPromise = receiveMsgQ(); rcvPromise.then(function(speechText) { console.log('rcv Promise resolved with ',speechText); return handlerInput.responseBuilder .speak(speechText) .withSimpleCard('skill_name', speechText) .withShouldEndSession(false) .getResponse(); }); Skill returns with ERROR message with no additional details about error. Is there any way to fix this problem? PS: I need to use promise as receiveMsgQ() is asynchronous function call.

2022-01-10 01:42:49    分类:问答    node.js   alexa   alexa-skills-kit   alexa-skill

AudioPlayer "PlaybackNearlyFinished" Request of Alexa Skills Kit, Not Working

I've written an Alexa Skill that uses a Lambda Function to play unique audio from a given URL. The Intent called "PlayAudio" is working and plays the first audio item from our JSON-formatted API. The Intent called "PlaybackNearlyFinished" does not work, aka, does not play the audio file I am feeding it. Can anybody crack exactly why this doesn't work? Here is a section from my Lambda Function, which contains the two Intents: Fact.prototype.intentHandlers = { "PlayAudio": function (event, context, response) { fetchEnseParse("/latest", function(body) { if(body == "error") { } else { var

2022-01-09 11:07:38    分类:问答    aws-lambda   alexa   alexa-skills-kit