实现中的 DialogFlow - 未定义 DeepLink

DialogFlow in Fulfillment - DeepLink is not defined

我正在尝试在 DialogFlow 的 Fulfillment Inline Editor 中使用 DeepLink,但出现错误 "DeepLink is not defined"。问题是如何将DeepLink导入到项目中?

有关深层链接的更多信息 class: deeplink class

我的index.js:

'use strict';

// Import the Dialogflow module from the Actions on Google client library.
const {dialogflow} = require('actions-on-google');

// Import the firebase-functions package for deployment.
const functions = require('firebase-functions');

// Instantiate the Dialogflow client.
const app = dialogflow({debug: true});


// Handle the Dialogflow intent named 'favorite color'.
// The intent collects a parameter named 'color'.
app.intent('favorite color', (conv, {color}) => {

这里我有错误"DeepLink is not defined"

  conv.ask(new DeepLink({
    destination: 'Google',
    url: 'http://my.deep.link',
    package: 'my.package.name',
    reason: 'handle this for you',
  }))
})

// Set the DialogflowApp object to handle the HTTPS POST request.
exports.dialogflowFirebaseFulfillment = functions.https.onRequest(app);

我的package.json

{
  "name": "dialogflowFirebaseFulfillment",
  "description": "This is the default fulfillment for a Dialogflow agents using Cloud Functions for Firebase",
  "version": "0.0.1",
  "private": true,
  "license": "Apache Version 2.0",
  "author": "Google Inc.",
  "engines": {
    "node": "~6.0"
  },
  "scripts": {
    "start": "firebase serve --only functions:dialogflowFirebaseFulfillment",
    "deploy": "firebase deploy --only functions:dialogflowFirebaseFulfillment"
  },
  "dependencies": {
    "actions-on-google": "^2.2.0",
    "firebase-admin": "^4.2.1",
    "firebase-functions": "^0.5.7",
    "dialogflow": "^0.1.0",
    "dialogflow-fulfillment": "^0.4.1"
  }
}

谢谢!

我去啦! :) 第 4 行应如下所示:

const {dialogflow, DeepLink} = require('actions-on-google');