简体   繁体   English

无法访问 Dialogflow webhook 参数

[英]Unable to access Dialogflow webhook Parameters

I have a webhook in DF however my web service cannot seem to get the JSON messages sent from DF.我在 DF 中有一个 webhook,但是我的 Web 服务似乎无法获取从 DF 发送的 JSON 消息。 How to access the object that would have DF's responses using node.js.如何使用 node.js 访问具有 DF 响应的对象。 Currently, my function is accepting a variable called req but req.body or req.queryResult doesn't seem to access DF parameters.目前,我的函数正在接受一个名为 req 的变量,但 req.body 或 req.queryResult 似乎无法访问 DF 参数。 Any help would be appreciated.任何帮助,将不胜感激。 My code is below which doesn't print any parameters from DF:我的代码在下面,它不从 DF 打印任何参数:

app.post("/", (req, res) => {
 console.log(req.body.queryResult.parameters);

You don't indicate what middleware, if any, you have setup for this route.您没有指明您为此路由设置了哪些中间件(如果有)。

You should be using the express.json() middleware, which will set req.body to a JavaScript object that should, at a minimum, contain the queryResult attribute.应该使用express.json()中间件,它将req.body设置为一个 JavaScript 对象,该对象至少应包含queryResult属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM