简体   繁体   English

我在 Dialogflow 上的 webhook 没有响应

[英]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.

相关问题 从node.js中的webhook发送不同的响应(Dialogflow) - Send different response from webhook in nodejs (Dialogflow) 格式错误的响应:从 dialogflow Web 挂钩获取响应时出现 Webhook 错误 - Malformed Ressponse: Webhook error on getting response from dialogflow web hook 从 nodejs webhook 发送响应表单对话流的正确方法是什么? - What is the proper way to send a response form dialogflow from nodejs webhook? Dialogflow:从 webhook 调用第三方 api 并等待响应 - Dialogflow: Call third party api from webhook and wait for response 如何将我本地的webhook连接到对话流? - How to connect webhook of my local to dialogflow? 在 dialogflow webhook 中设置了响应,但它返回未设置响应 - Response is set in dialogflow webhook but it returns that no response has been set Dialogflow - 来自 Cloud Firestore 的内联 webhook - Dialogflow - inline webhook from Cloud Firestore 从Dialogflow中的WebHook保留意图之间的数据 - Keeping data between intents from WebHook in Dialogflow 如何通过 dialogflow API 服务将请求标头从集成传递到我的 webhook 服务? - How to pass request headers from integration to my webhook service through dialogflow API service? Dialogflow Webhook意向响应中的OpenSearch调用不返回数据 - OpenSearch call in Dialogflow webhook intent response does not return data
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM