Webhook 调用失败

Webhook call failed

我创建了新代理并启用了默认欢迎意图的实现,还启用了内联编辑器,但是当我在模拟器中调用我的欢迎意图时,它给我默认响应而不是实现响应。

我是不是做错了什么?

这是我的代码

'use strict';

const functions = require('firebase-functions');
const {WebhookClient} = require('dialogflow-fulfillment');
const {Card, Suggestion} = require('dialogflow-fulfillment');

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) {
    agent.add(`Welcome to my agent!`);
  }

  function fallback(agent) {
    agent.add(`I'm sorry, can you try again?`);
  }


  let intentMap = new Map();
  intentMap.set('Default Welcome Intent', welcome);
  intentMap.set('Default Fallback Intent', fallback);
  agent.handleRequest(intentMap);

});

我已经更改了我的代码,现在可以使用了

这是我的新密码

'use strict'; 
const functions = require('firebase-functions');
const {dialogflow} = require ('actions-on-google');
const {Suggestions} = require ('actions-on-google');
const WELCOME_INTENT = 'Default Welcome Intent';
const FALLBACK_INTENT = 'Default Fallback Intent';

const app = dialogflow();

app.intent(FALLBACK_INTENT, (conv) => {
    conv.ask("Sorry! Could you please repeat that?");
});

app.intent(WELCOME_INTENT, (conv) => {
    conv.ask("Hello!");
    conv.ask("What you would like to do?");    
});

exports.dialogflowFirebaseFulfillment = functions.https.onRequest(app);