[英]No response from my webhook on Dialogflow
This is the code I have in my server:这是我在服务器中的代码:
const express = require('express');
const bodyParser = require('body-parser');
const appExpress = express().use(bodyParser.json());
const {
dialogflow,
Image,
} = require('actions-on-google')
const app = dialogflow()
appExpress.post('/hook', express.json() ,(req, res) => {
app.intent('MyIntent', conv => {
conv.ask('Hi, how is it going?')
});
});
appExpress.listen(3333, ()=>console.log("Server is live at port 3333"));
When I run this, it returns no errors (I see the message "server is live..") and also when I send a message to my bot with the intent "MyIntent" I get no error, but also no response..当我运行它时,它没有返回任何错误(我看到消息“服务器正在运行..”),而且当我向我的机器人发送带有“MyIntent”意图的消息时,我没有收到错误,但也没有响应..
If I look at the Diagnostic Info, under the Fulfillment Status there is this error:如果我查看诊断信息,在履行状态下会出现以下错误:
Webhook call failed.
网络钩子调用失败。 Error: DEADLINE_EXCEEDED.
错误:DEADLINE_EXCEEDED。
What am I doing wrong?我究竟做错了什么?
I don't know how that google library is supposed to work, but generally when using express, you most close the HTTP request by sending a response, there are several examples here我不知道 google 库应该如何工作,但通常在使用 express 时,您最常通过发送响应来关闭 HTTP 请求,这里有几个示例
https://expressjs.com/en/guide/routing.html https://expressjs.com/en/guide/routing.html
You could try adding this after convo.ask
你可以尝试在
convo.ask
之后添加这个
res.sendStatus(200);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.