串連dialogflow 與firebase realtime database

單次$200

 / 

在家兼職

1年前


刊登案主

游小姐

任務內容

  • 【幫忙事項】:我跟著這個影片
  • https://www.youtube.com/watch?v=sdbgWXwPW0c&t=619s
  • 操作,但失敗了
  • 我在dialogflow 上看到的錯誤訊息是「Webhook call failed. Error: UNAVAILABLE, State: URL_UNREACHABLE, Reason: UNREACHABLE_5xx, HTTP status code: 500.」
  • 在cloud error reporting上看到的是
  • 「Error : No handler for requested intent」
  • 「Error : Process exited with code 16」
  • 下面是我的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);
  • });
  • 我應該怎麼做才可以讓dialogflow 與firebase 連接起來
  • 【注意事項】:

任務地點

在家兼職


支薪方式

行動支付、匯款

支薪日

完成即付


任務時間

工作日期:2023/02/17~2023/02/24

#臨時工 #短期打工 #寒假打工

需求人數

1人


推薦職缺 (20)

打開 APP 火速應徵!千萬別錯過唷 ~

老闆正在 APP 裡面等你

job-qrcode

快掃 QRCode 找他應徵!