Last active
May 12, 2018 15:10
-
-
Save flatfisher/5d0ef88918b52b21152460025ec45476 to your computer and use it in GitHub Desktop.
Table Cardを試してみた #io18jp ref: https://qiita.com/flatfisher/items/06ea64dfb9063f2f7460
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
actions.capability.SCREEN_OUTPUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ firebase init | |
? What language would you like to use to write Cloud Functions? JavaScript | |
? Do you want to use ESLint to catch probable bugs and enforce style? No | |
✔ Wrote functions/package.json | |
✔ Wrote functions/index.js | |
? Do you want to install dependencies with npm now? Yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ firebase deploy | |
Function URL: https://us-central1-flatfishtest.cloudfunctions.net/xxx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const { dialogflow, Table, Image, Button } = require('actions-on-google'); | |
const functions = require('firebase-functions'); | |
const app = dialogflow(); | |
app.intent('TableCard', (conv) => { | |
conv.ask('Here you go!'); | |
conv.ask(new Table({ | |
title: 'Title', | |
subtitle: 'subtitle', | |
image: new Image({ | |
url: 'https://your-server/apple.png', | |
alt: 'Apple' | |
}), | |
dividers: true, | |
columns: ['header 1', 'header 2', 'header 3'], | |
rows: [ | |
['row 1 item 1', 'row 1 item 2', 'row 1 item 3'], | |
], | |
buttons: new Button({ | |
title: 'GitHub', | |
url: 'https://github.com/actions-on-google' | |
}), | |
})); | |
}); | |
exports.flatfishtest = functions.https.onRequest(app); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "functions", | |
"description": "Cloud Functions for Firebase", | |
"scripts": { | |
"serve": "firebase serve --only functions", | |
"shell": "firebase functions:shell", | |
"start": "npm run shell", | |
"deploy": "firebase deploy --only functions", | |
"logs": "firebase functions:log" | |
}, | |
"dependencies": { | |
"actions-on-google": "^2.1.1", | |
"firebase-admin": "~5.12.0", | |
"firebase-functions": "^1.0.1" | |
}, | |
"private": true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment