Fulfillment中的DialogFlow - 未定义DeepLink

问题描述 投票:0回答:1

我正在尝试在DialogFlow中的Fulfillment Inline Editor中使用DeepLinks,但是我收到错误“DeepLink未定义”。问题是如何将DeepLink导入项目?

有关deeplink类的更多信息: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未定义”

  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"
  }
}

谢谢!

node.js dialogflow actions-on-google
1个回答
2
投票

我懂了! :)第4行应该是这样的:

const {dialogflow, DeepLink} = require('actions-on-google');
© www.soinside.com 2019 - 2024. All rights reserved.