Slide 31
Slide 31 text
● npmでインストール
○ npm install actions-on-google --save
○ npm install firebase-functions --save
● 会話に対する処理のハンドルに
DialogflowApp クラスを利用。
● DialogflowからのIntentに対する処理を定義
app.intent(‘Intent名’), conv => {
// 会話に対する処理
})
応答メソッド 説明
conv.ask 応答 + 返答待ち
conv.close 応答 + アプリ終了
const { dialogflow } = require('actions-on-google')
const functions = require('firebase-functions')
const app = dialogflow()
exports.endpoint = functions.https.onRequest(app)
app.intent('Default Welcome Intent', conv => {
conv.ask('アプリが起動しました。何か話してください
')
})
app.intent('Good Bye', conv => {
conv.close('会話を終了します。さようなら
')
})
AoG Client Library for Node.js の使い方【3/3】