我尝试在 DialogFlow 的 Fulfillment 内联编辑器中使用 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"
}
}
谢谢!
最佳答案
我去啦! :) 第 4 行应如下所示:
const {dialogflow, DeepLink} = require('actions-on-google');
关于node.js - Fulfillment 中的 DialogFlow - DeepLink 未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52307746/