typescript - 使用 TypeScript 在 Google 上操作:如何开始?
问题描述
我正在使用操作控制台。当用“HookIntent”调用我的动作时,我总是得到:
{
"error": "No intent was provided and fallback handler is not defined."
}
我的 index.ts:
import * as functions from 'firebase-functions'
import {
dialogflow
} from 'actions-on-google'
const app = dialogflow({debug: true});
app.intent('HookIntent', (conv) => {
const response = "Hello Test"
conv.add(response)
})
exports.playMusicFunction = functions.https.onRequest(app);
杰森:
{
"handler": {
"name": "HookIntent"
},
"intent": {
"name": "HookIntent",
...
我找不到任何带有打字稿的工作示例。来自 google 的所有示例和培训都使用 Javascript。
解决方案
我将同意 Jordi 的评论,您应该改用@assistant/conversation
并重构您的一些代码以使用 Actions Builder 平台 webhook。
import * as functions from 'firebase-functions'
import {
conversation
} from '@assistant/conversation'
const app = conversation({debug: true})
app.handle('HookIntent', (conv) => {
const response = "Hello Test"
conv.add(response)
})
exports.playMusicFunction = functions.https.onRequest(app)
推荐阅读
- php - 等于或大于与 whereIn 或 laravel 中的数组
- javascript - 测试本地网页的速度
- html - Bootstrap 4 导航栏的汉堡扩展但不折叠
- sql - 如果 postgres 中的值为空白,则使用另一个字段值更新表字段
- android - 调整大小和恢复/暂停 GLSurfaceView 时出现问题
- javascript - 如何在 Cypress 中测量 XHR 响应持续时间?
- javascript - 如何使用 JavaScript 处理 Android 后退按钮?
- amazon-web-services - 多个aws实例中的咖啡因缓存,如何使它们无效?
- r - R lapply 用于列表列表以将相同的功能应用于预定义的列
- javascript - 通过 document.write 警告调用解析器阻塞、跨站点(即不同的 eTLD+1)脚本