使用 TypeScript 在 Google 上的操作:如何开始?
Actions On Google with TypeScript: How to start?
我正在使用操作控制台。
使用“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);
Json:
{
"handler": {
"name": "HookIntent"
},
"intent": {
"name": "HookIntent",
...
我找不到任何使用打字稿的工作示例。来自 google 的所有示例和训练都与 Javascript.
我同意 Jordi 的意见,您应该改用 @assistant/conversation
并重构您的一些代码以使用 Actions Builder 平台网络钩子。
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)
我正在使用操作控制台。 使用“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);
Json:
{
"handler": {
"name": "HookIntent"
},
"intent": {
"name": "HookIntent",
...
我找不到任何使用打字稿的工作示例。来自 google 的所有示例和训练都与 Javascript.
我同意 Jordi 的意见,您应该改用 @assistant/conversation
并重构您的一些代码以使用 Actions Builder 平台网络钩子。
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)