使用Google SDK上的Actions获取Dialogflow webhook路径参数

时间:2019-09-24 13:32:37

标签: node.js google-cloud-functions dialogflow actions-on-google

有没有办法检索由Dialogflow实现Webhook设置的路径参数? 我正在Google Cloud Function中使用Node.js Google-Actions SDK。

我的webhook URL是这样的:https://europe-myexample.cloudfunctions.net/actionHandler/v1

我需要获取v1参数才能在manageWelcomeIntent函数中使用它。

const NLGService = require('./services/NLGService.js');
const {dialogflow} = require('actions-on-google');
const app = dialogflow();

exports.actionHandler = app;

app.intent('welcome_intent', NLGService.manageWelcomeIntent);

1 个答案:

答案 0 :(得分:1)

例如采用 const url = require('url');,或更简单的req.url 找出服务器网址,然后提取参数?