我是一个菜鸟,试图用nodejs google动作库编写我的第一个google助手webhook。虽然我已经使用curl命令部署并访问了我的服务,但我无法从dialogFlow -> integrations -> GoogleAssistant ->测试控制台调用它。
另外,请注意,我还没有使用谷歌云功能或heroku进行部署。我已经安装了裂变kubernetes的无服务器函数的GKE。网钩是裂变函数。
我想做的事情的一些细节:
下面粘贴了我的代码,因为这个函数是对index.js的一个很小的修改,它来自于本文中的https://developers.google.com/actions/dialogflow/first-app
'use strict';
process.env.DEBUG = 'actions-on-google:*';
const App = require('actions-on-google').DialogflowApp;
const functions = require('firebase-functions');
// a. the action name from the make_name Dialogflow intent
const NAME_ACTION = 'make_name';
// b. the parameters that are parsed from the make_name intent
const COLOR_ARGUMENT = 'color';
const NUMBER_ARGUMENT = 'number';
module.exports = async function(context) {
const app = new App({request: context.request, response: context.response});
console.log('Request headers: ' + JSON.stringify(context.request.headers));
console.log('Request body: ' + JSON.stringify(context.request.body));
// c. The function that generates the silly name
function makeName (app) {
let number = app.getArgument(NUMBER_ARGUMENT);
let color = app.getArgument(COLOR_ARGUMENT);
app.tell('Alright, your silly name is ' +
color + ' ' + number +
'! I hope you like it. See you next time.');
}
// d. build an action map, which maps intent names to functions
let actionMap = new Map();
actionMap.set(NAME_ACTION, makeName);
app.handleRequest(actionMap);
}任何关于如何调试它的输入/指针都是非常有益的。
谢谢。
发布于 2018-05-31 14:51:17
在用WebDemo UI发布了一些文本之后,我也有了同样的问题。谷歌助理开始使用完全相同的文字,我不知道如何修复它。但似乎它的集成错误,或与意图检测到谷歌助理的阈值问题。
https://stackoverflow.com/questions/49015307
复制相似问题