简体   繁体   English

实现中的DialogFlow-未定义DeepLink

[英]DialogFlow in Fulfillment - DeepLink is not defined

I'm trying to use DeepLinks in Fulfillment Inline Editor in DialogFlow but I get error "DeepLink is not defined". 我正在尝试在DialogFlow的实现内联编辑器中使用DeepLink,但出现错误“ DeepLink未定义”。 The question is how to import DeepLink into project? 问题是如何将DeepLink导入项目?

more info about deeplink class: deeplink class 有关deeplink类的更多信息: deeplink类

My index.js: 我的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}) => {

here I have error "DeepLink is not defined" 这里我有错误“ 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);

My package.json 我的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"
  }
}

Thanks! 谢谢!

I've go it! 我去了! :) The line 4 should looks like: :)第4行应如下所示:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM