我想只获得基本的node.js webhook回声示例工作在heroku上。但是,我不断收到206错误。我听说这可能来自heroku做的重定向或不完整的json。这里有帮助吗?api.ai webhook不工作在heroku上,错误206部分内容
我也附上了我的意图截图上api.ai
我获得与雅虎天气Python应用程序同样的错误,所以我不知道怎么回事,因为这是所有api.ai配置。
,我在这里问的问题以及https://discuss.api.ai/t/webhook-issue-error-206/4535/4
我的代码如下,我是新来的node.js,有什么不妥?我添加了我认为api.ai在其JSON中需要的字段。
app.post('/hook', function(req, res) {
console.log('hook request');
try {
var speech = 'empty';
if (req.body) {
if (req.body.result) {
speech = '';
if (req.body.result.fulfillment) {
speech += req.body.result.fulfillment.speech;
speech += ' ';
}
if (req.body.result.action) {
speech += 'action: ' + req.body.result.action;
}
}
}
console.log('result: ', speech);
return res.json({
speech: speech,
displayText: speech,
data: [],
contextOut: [],
source: 'yahooweather'
});
当api.ai尝试访问它时,这是paratrail在我的heroku服务器上说的:'at = info method = POST path =“/”host = car-status.herokuapp.com request_id = b08633f7-33ab-45f3-9493 -91be258a2b52 fwd =“54.157.251.180”dyno = web.1 connect = 0ms service = 25ms status = 404 bytes = 376 protocol = https' – MadeByDouglas
这两个示例都不工作https://github.com/api-ai/apiai- webhook-sample和https://github.com/api-ai/apiai-webhook-sample – MadeByDouglas