LoginSignup
2
3

More than 5 years have passed since last update.

actions on googleテンプレ

Last updated at Posted at 2018-04-06

google assistantのアクションを作るときの俺用テンプレ

学習段階で作ったものだから、これから変更していく可能性あり。
バージョンは"actions-on-google": "^1.5.x"にて使用。

'use strict';

const functions = require('firebase-functions'); 
const DialogflowApp = require('actions-on-google').DialogflowApp;
exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => {
    const app = new DialogflowApp({request: request, response: response});



    const actionMap = new Map();
    // ○○を開いて、って言った時に呼ばれる
    actionMap.set("input.welcome", welcomeIntent);
    // ここは自分で定義したアクション名。プロジェクトごとに帰る必要あり
    actionMap.set("start_action", startIntent);
    app.handleRequest(actionMap);
});

function welcomeIntent (app) {
}
function startIntent (app) {
}


// ssmlに対応させる
function makeSsml(msg){
    return "<speak>" + msg + "</speak>";
}
2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3