我可以确定 Alexa 请求是由例程还是用户触发的吗?
Can I determine whether an Alexa Request was triggered by a routine or a user?
我需要区分显式请求和例程请求。
这是一个例子。假设我正在控制智能灯。灯能够检测占用。
如果用户进入房间并说打开灯,它会检查入住情况并关闭。
但是,如果用户创建了一个预定例程来打开灯,我们应该禁用占用检查。
我在 TurnOn 指令的 documentation 中没有看到任何指示请求来源的内容。
有没有我漏掉的指标?我可以添加一些指标吗?或者有人使用不同的方法来完成类似的功能吗?
亚马逊的官方回应是你无法分辨。以下是亚马逊 Alexa 开发者论坛的最新回复:https://forums.developer.amazon.com/questions/218340/skills-invoking-routines.html
也就是说,如果启动请求是从例程启动的,您通常会在启动请求中看到其他字段:
"request": {
"type": "LaunchRequest",
"requestId": "amzn1.echo-api.request.abunchofnumbers",
"timestamp": "2020-01-18T22:27:01Z",
"locale": "en-US",
"target": {
"path": "AMAZON.Launch",
"address": "amzn1.ask.skill.abunchofnumbers"
},
"metadata": {
"referrer": "amzn1.alexa-speechlet-client.SequencedSimpleIntentHandler"
},
"body": {},
"payload": {},
"targetURI": "alexa://amzn1.ask.skill.abunchofnumbers/AMAZON.Launch",
"launchRequestType": "FOLLOW_LINK_WITH_RESULT",
"shouldLinkResultBeReturned": true
}
当用户使用语音启动技能时,通常找不到目标、元数据、正文、负载、targetURI 和 launchRequestType 字段。但是,我不认为这些字段的存在是由 Alexa Routine 启动的。我怀疑如果在 Alexa 询问 "Hey, since you like the Blind Monkey skill would you like to try Blind Pig?" 并且你说 "yes."
时启动该技能,你会找到它们
我需要区分显式请求和例程请求。
这是一个例子。假设我正在控制智能灯。灯能够检测占用。
如果用户进入房间并说打开灯,它会检查入住情况并关闭。 但是,如果用户创建了一个预定例程来打开灯,我们应该禁用占用检查。
我在 TurnOn 指令的 documentation 中没有看到任何指示请求来源的内容。
有没有我漏掉的指标?我可以添加一些指标吗?或者有人使用不同的方法来完成类似的功能吗?
亚马逊的官方回应是你无法分辨。以下是亚马逊 Alexa 开发者论坛的最新回复:https://forums.developer.amazon.com/questions/218340/skills-invoking-routines.html
也就是说,如果启动请求是从例程启动的,您通常会在启动请求中看到其他字段:
"request": {
"type": "LaunchRequest",
"requestId": "amzn1.echo-api.request.abunchofnumbers",
"timestamp": "2020-01-18T22:27:01Z",
"locale": "en-US",
"target": {
"path": "AMAZON.Launch",
"address": "amzn1.ask.skill.abunchofnumbers"
},
"metadata": {
"referrer": "amzn1.alexa-speechlet-client.SequencedSimpleIntentHandler"
},
"body": {},
"payload": {},
"targetURI": "alexa://amzn1.ask.skill.abunchofnumbers/AMAZON.Launch",
"launchRequestType": "FOLLOW_LINK_WITH_RESULT",
"shouldLinkResultBeReturned": true
}
当用户使用语音启动技能时,通常找不到目标、元数据、正文、负载、targetURI 和 launchRequestType 字段。但是,我不认为这些字段的存在是由 Alexa Routine 启动的。我怀疑如果在 Alexa 询问 "Hey, since you like the Blind Monkey skill would you like to try Blind Pig?" 并且你说 "yes."
时启动该技能,你会找到它们