0

I had followed the video (link) to connect firebase to dialogflow, but there had some errors that I can’t realized. I followed the video

My problem is dialogflow always shows 「Webhook call failed. Error: UNAVAILABLE, State: URL_UNREACHABLE, Reason: UNREACHABLE_5xx, HTTP status code: 500.」

Firebase show 「Error : No handler for requested intent」 「Error : Process exited with code 16」

「Error : No handler for requested intent」

「Error : Process exited with code 16」

This is my firebase firebase realtime image

This is my fulfillment

'use strict';
 
const functions = require('firebase-functions');
const {WebhookClient} = require('dialogflow-fulfillment');
const {Card, Suggestion} = require('dialogflow-fulfillment');
const firebaseAdmin = require("firebase-admin");
 
process.env.DEBUG = 'dialogflow:debug'; // enables lib debugging statements
 
firebaseAdmin.initializeApp({
  credential:firebaseAdmin.credential.applicationDefault(),
  databaseURL:'ws://coherent-lock-376605-default-rtdb.asia-southeast1.firebasedatabase.app/',
});

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) {
    var dateTime = new Date();
    agent.add(`HIHI! The time is :` + dateTime);
  }
 
  function fallback(agent) {
    agent.add(`I didn't understand`);
    agent.add(`I'm sorry, can you try again?`);
  }

  function getFromFirebase(agent){
    return firebaseAdmin.database().ref('address').once("value").then((snapshot) =>{
      var address = snapshot.child().val();
      agent.add('hey! the address is :'+address);
    
    });
  }
  
  
  let intentMap = new Map();
  intentMap.set('Default Welcome Intent', welcome);
  intentMap.set('Default Fallback Intent', fallback);
  intentMap.set('地址', getFromFirebase);
  // intentMap.set('your intent name here', googleAssistantHandler);
  agent.handleRequest(intentMap);
});

Can anyone help me to solve it?

  • Don't just use same placeholder `enter image description here`.Please add valid Text to image in if you creating hyper link for the image. – Milan Surelia Feb 06 '23 at 15:28

0 Answers0