我想只獲得基本的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