【发布时间】:2017-07-13 15:04:40
【问题描述】:
开发一个我将通过语音命令控制硬件的演示,然后是一个 Node.ja 示例,当我在服务模拟器中测试时它工作正常,但是当我来到 echo dot 时,意图没有被识别,认为我是缺少会话,我不知道我怎么能在这里做到这一点
这是 index.js
"use strict";
var http = require('http');
var request = require('request');
var Alexa = require("alexa-sdk");
var appId = "amzn1.ask.skill.91bca194-194a-4ca8-92c1-XXXXSDE";
exports.handler = function(event, context, callback) {
var alexa = Alexa.handler(event, context);
alexa.APP_ID = appId;
alexa.registerHandlers(handlers);
alexa.execute();
};
var handlers = {
"LaunchRequest": function () {
this.emit(':tell', 'Welcome home');
},
"CloseIntent": function () {
console.log("Gets into CloseIntent");
this.emit(':tell', "The gate is closed");
},
"OpenIntent": function () {
console.log("Gets into OpenIntent");
this.emit(':tell', "The gate is open");
},
"HelloIntent": function () {
this.emit(':tell', "Hello Welcome ");
},
"AboutIntent": function () {
this.emit(':tell', "The ONLY complete products");
}
};
这是我的意图架构
{
"intents": [
{
"intent": "HelloIntent"
},
{
"intent": "OpenIntent"
},
{
"intent": "CloseIntent"
},
{
"intent": "AboutIntent"
}
]
}
【问题讨论】:
-
您是否可能没有为您的意图提供足够的示例话语?
-
我提供了示例话语,我解决了问题,实际上是我错过了调用名称
-
只是一个提示:
alexa.APP_ID应该是alexa.appID根据文档
标签: node.js alexa alexa-skills-kit alexa-skill