Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 如何使用Firebase为google sigin添加实现云功能的代码_Node.js_Dialogflow Es_Google Assistant Sdk_Assistant - Fatal编程技术网

Node.js 如何使用Firebase为google sigin添加实现云功能的代码

Node.js 如何使用Firebase为google sigin添加实现云功能的代码,node.js,dialogflow-es,google-assistant-sdk,assistant,Node.js,Dialogflow Es,Google Assistant Sdk,Assistant,我需要要求用户登录。怎么做?我没有从谷歌搜索结果、StackOverflow和youtube中得到有效的示例。 'use strict'; const functions = require('firebase-functions'); const { WebhookClient } = require('dialogflow-fulfillment'); const { Card, Suggestion } = require('dialogflow-fulfillment'); const

我需要要求用户登录。怎么做?我没有从谷歌搜索结果、StackOverflow和youtube中得到有效的示例。

'use strict';

const functions = require('firebase-functions');
const { WebhookClient } = require('dialogflow-fulfillment');
const { Card, Suggestion } = require('dialogflow-fulfillment');
const { dialogflow, SignIn } = require('actions-on-google');
const app = dialogflow({
    // REPLACE THE PLACEHOLDER WITH THE CLIENT_ID OF YOUR ACTIONS PROJECT
    clientId: '93232567633.apps.googleusercontent.com',
});

process.env.DEBUG = 'dialogflow:debug'; // enables lib debugging statements




exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => {
    const agent = new WebhookClient({ request, response });
    console.log('Dialogflow Request headers: ' + JSON.stringify(request.headers));
    console.log('Dialogflow Request body: ' + JSON.stringify(request.body));

    function welcome(agent) {
      app.intent('ask_for_sign_in_detail', (conv) => {
        conv.ask(new SignIn());
      });   

        agent.add(`Welcome to my agent!`);
    }

    function fallback(agent) {
        agent.add(`I didn't understand. feel free to ask anything related to aquarium shop. we are always ready to help you. You can ask the fish price or delivery available location details etc. Is there anything else?`);
        agent.add(`I'm sorry, would you please try again?`);
    }

    function androidApp(agent) {
        agent.add(`Aquarium Shop app is available in google play Store. Is there anything else i can assist you?`);


    }
    var showLogCard = false;



    // Run the proper function handler based on the matched Dialogflow intent name
    let intentMap = new Map();
    intentMap.set('Default Welcome Intent', welcome);
    //intentMap.set('AndroidApp', androidApp);
    intentMap.set('Default Fallback Intent', fallback);

    // intentMap.set('your intent name here', googleAssistantHandler);
    agent.handleRequest(intentMap);
});

您是否已经在Google project的操作中添加了Google登录?是的,我已经加了