获取用户ID GoogleActions
我试图让火力地堡的用户ID来我的谷歌用户,但显然它是不确定的获取用户ID GoogleActions
dialogflowFirebaseFulfillment ReferenceError: userId is not defined
at IncomingMessage.resp.on (/user_code/index.js:73:17)
at emitNone (events.js:91:20)
at IncomingMessage.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:974:12)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickDomainCallback (internal/process/next_tick.js:128:9)
这是我的代码
const REQUEST_PERMISSION_ACTION = 'request_permission'; const userUID = app.getUser().userId;
const userName = app.getUserName().displayName;
console.log(userUID, 'USERRRRRRID');
我能做些什么来获取用户标识?
回答:
这是我的代码
function processV1Request (request, response) { let action = request.body.result.action; // https://dialogflow.com/docs/actions-and-parameters
let parameters = request.body.result.parameters; // https://dialogflow.com/docs/actions-and-parameters
let inputContexts = request.body.result.contexts; // https://dialogflow.com/docs/contexts
let requestSource = (request.body.originalRequest) ? request.body.originalRequest.source : undefined;
const googleAssistantRequest = 'google'; // Constant to identify Google Assistant requests
const app = new DialogflowApp({request: request, response: response});
// Create handlers for Dialogflow actions as well as a 'default' handler
const actionHandlers = {
// The default welcome intent has been matched, welcome the user (https://dialogflow.com/docs/events#default_welcome_intent)
'input.welcome':() => {
sendGoogleResponse(' Bonjour, Que puis je faire pour vous ?');
},
'input.what':() => {
const http = require('http');
const https = require('https');
https.get('https://bnpparibas-api.openbankproject.com/obp/v3.0.0/my/banks/bnpparibas.07.fr/accounts/cbf874f8-9eb1-4fdf-899c-54b8c5e7c2c8/account', (resp) => {
let data = '';
const app = new ActionsSdkApp({request: request, response: response});
// A chunk of data has been recieved.
resp.on('data', (chunk) => {
data += chunk;
});
回答:
你要问助手,引导用户授予权限为您的应用程序来获取此信息更大的作用。
看看here
以上是 获取用户ID GoogleActions 的全部内容, 来源链接: utcz.com/qa/262242.html