• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

获取用户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; 

    }); 

版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)