Skip to content

Instantly share code, notes, and snippets.

Silvano Luciani silvolu

  • Mountain View
Block or report user

Report or block silvolu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@silvolu
silvolu / idtoken_sample.js
Last active Sep 17, 2018
IdToken content sample
View idtoken_sample.js
{
// The unique ID of the user's Google Account
"sub": 1234567890,
// The token's issuer
"iss": "https://accounts.google.com",
// Client ID assigned to your Actions project
"aud": "123-abc.apps.googleusercontent.com",
// Unix timestamp of the token's creation time
"iat": 233366400,
// Unix timestamp of the token's expiration time
@silvolu
silvolu / v2-framworks-express.js
Created Mar 17, 2018
Publish Actions on Google V2 apps from self-hosted express
View v2-framworks-express.js
const express = require('express')
const bodyParser = require('body-parser')
const { dialogflow } = require('actions-on-google')
const app = dialogflow()
express().use(bodyParser.json(), app).listen(3000)
@silvolu
silvolu / v2-framworks-lambda.js
Created Mar 17, 2018
Publish Actions on Google V2 apps from AWS Lambda
View v2-framworks-lambda.js
const { dialogflow } = require('actions-on-google')
const app = dialogflow()
exports.factsAboutGoogle = app
@silvolu
silvolu / v2-framworks-cff.js
Created Mar 17, 2018
Publish Actions on Google V2 apps from Cloud Functions for Firebase
View v2-framworks-cff.js
const functions = require('firebase-functions')
const { dialogflow } = require('actions-on-google')
const app = dialogflow()
exports.factsAboutGoogle = functions.https.onRequest(app)
@silvolu
silvolu / v2-no-builders.js
Created Mar 13, 2018
Comparison between creating a BasicCard in v1 and in v2
View v2-no-builders.js
// v1
app.buildRichResponse(
app.buildBasicCard('some string')
.setImage('https://site.com/img.png', 'some other string'))
// v2
conv.ask(new BasicCard({
title: 'some string',
image: {
url: 'https://site.com/img.png',
@silvolu
silvolu / v2-conv-ask.js
Last active Mar 16, 2018
Calling ask multiple times
View v2-conv-ask.js
app.intent('tell.greeting', (conv, { color, num }) => {
conv.ask(`Dialogflow likes ${color}`, new Suggestions('Ok', 'Cool'))
conv.ask(new BasicCard({
title: 'Card Title',
image: { // Mostly, provide anonymous Objects
url: 'https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png',
accessibilityText: 'Google Logo',
},
buttons: new Button({ // Wrapper for complex sub Objects, but can also use Objects when needed
title: 'Button Title',
@silvolu
silvolu / v2-conv-close.js
Last active Mar 16, 2018
Use conv.close in the Actions on Google client library v2.
View v2-conv-close.js
app.intent('Default Welcome Intent', conv => {
conv.close('Thanks for talking to me!')
})
@silvolu
silvolu / v2-conv.js
Created Mar 13, 2018
The new Conversation abstraction
View v2-conv.js
const app = dialogflow({ debug: true })
app.intent('Default Welcome Intent', conv => {
conv.ask('Hi')
})
@silvolu
silvolu / v2-plugins.js
Last active Mar 16, 2018
Using plugins with Actions on Google client library v2
View v2-plugins.js
const { dialogflow } = require('actions-on-google')
const { randomize, Randomization } = require('randomize')
const app = dialogflow()
.use(randomize)
app.intent('tell.greeting', conv => {
conv.ask(`The last thing I told you was ${conv.randomize.last}`)
conv.ask(new Randomization(
'How are you?',
@silvolu
silvolu / v2-frameworks.js
Created Mar 13, 2018
Publish Actions on Google V2 apps from different frameworks
View v2-frameworks.js
// Cloud Functions for Firebase
const functions = require('firebase-functions')
const { dialogflow } = require('actions-on-google')
const app = dialogflow()
exports.factsAboutGoogle = functions.https.onRequest(app)
// AWS Lambda
You can’t perform that action at this time.