我已经创建了一个基于这个例子Alexa的简单技能访问网址:https://github.com/alexa/skill-sample-nodejs-fact/blob/en-US/lambda/custom/index.jsAlexa的距离的NodeJS亚马逊LAMBDA
现在,我想的脚本来登录一些不同的服务器上,当GetNewFactIntent被称为。
这就是我想要做的,但有这个一个问题,这是不应该在http.get回调什么。
'GetNewFactIntent': function() {
//var thisisit = this;
http.get("http://example.com", function(res) {
//console.log("Got response: " + res.statusCode);
const factArr = data;
const factIndex = Math.floor(Math.random() * factArr.length);
const randomFact = factArr[factIndex];
const speechOutput = GET_FACT_MESSAGE + randomFact;
this.response.cardRenderer(SKILL_NAME, randomFact);
this.response.speak(speechOutput);
this.emit(':responseReady');
}).on('error', function(e) {
//console.log("Got error: " + e.message);
});
},
在上面这个工作的例子要更换什么这需求?
我不能立即看到问题与该代码。您能否添加有关其失败原因的其他信息?需要更多的上下文。 –