Skip to content

Instantly share code, notes, and snippets.

View savelee's full-sized avatar

Lee Boonstra savelee

View GitHub Profile
@savelee
savelee / index.js
Created October 25, 2018 15:14
tvguide index.js
//https://us-central1-leeboonstra-blogdemos.cloudfunctions.net/tvguidefeed?channels=4&days=0
'use strict';
const {WebhookClient} = require('dialogflow-fulfillment');
const {Card, Suggestion} = require('dialogflow-fulfillment');
const rp = require('request-promise');
process.env.DEBUG = 'dialogflow:debug'; // enables lib debugging statements
@savelee
savelee / _index.js
Last active August 18, 2022 09:45
Actions on Google starter template (firebase)
'use strict';
const functions = require('firebase-functions');
const {
dialogflow,
Suggestions,
Image,
BasicCard,
MediaObject,
List,
@savelee
savelee / index.js
Last active August 18, 2022 09:43
Conditional Templating in Dialogflow with Custom Payloads and Google Cloud Functions
'use strict';
const {
dialogflow
} = require('actions-on-google');
const pug = require('pug');
/*
* Uses Pug.js https://pugjs.org/language/plain-text.html
* Requires a Dialogflow custom payload like:
@savelee
savelee / app.js
Last active August 18, 2022 09:46
Actions on Google for Google Cloud Functions
'use strict';
const {
dialogflow
} = require('actions-on-google'); //version 2.1.1
const assistantHandler = (conv) => {
console.log('Dialogflow Request headers: ' + JSON.stringify(conv.headers));
console.log('Dialogflow Request body: ' + JSON.stringify(conv.body));
@savelee
savelee / index.js
Last active May 24, 2018 22:11
Firebase TV Guide assistant
// See https://github.com/dialogflow/dialogflow-fulfillment-nodejs
// for Dialogflow fulfillment library docs, samples, and to report issues
'use strict';
const functions = require('firebase-functions');
const {WebhookClient} = require('dialogflow-fulfillment');
const {Card, Suggestion} = require('dialogflow-fulfillment');
const rp = require('request-promise');
@savelee
savelee / index.js
Last active October 17, 2018 13:53
V2 - TV Guide
{
"name": "my-tvguide-agent",
"description": "Build the TV Guide agent for Google Assistant with Dialogflow",
"version": "1.0.0",
"license": "Apache-2.0",
"author": "Lee Boonstra",
"engines": {
"node": "^8"
},
"dependencies": {
@savelee
savelee / gist:92b86161c40278b33590baa575b17830
Last active April 5, 2018 08:33
AIY Raspbain - Create the image manually
Follow Procedure Produced Errors:
Download https://www.raspberrypi.org/downloads/raspbian/ (2018-03-13) unzip, and burn to SD card with https://etcher.io/
Select a working WIFI network.
To open a terminal you can use: CTRL + ALT + T
git clone https://github.com/google/aiyprojects-raspbian.git AIY-projects-python
sudo apt-get install python-virtualenv
@savelee
savelee / my_assistant.service
Created April 3, 2018 14:33
Google Assistant on a Raspberry Pi (AIY Voicekit). - Headless reboot
//follow these steps in order to make the raspberry pi reboot in headless mode
1. Open my_assistant.service file in an editor:
sudo nano /lib/systemd/system/my_assistant.service
2. Copy contents of my_assistant.service in editor
3. Make your service script executable:
sudo chmod 644 /lib/systemd/system/my_assistant.service
@savelee
savelee / .js
Last active September 15, 2017 15:11
TVGuide - Google Assistant Code
'use strict';
process.env.DEBUG = 'actions-on-google:*';
const request = require('request');
const Assistant = require('actions-on-google').ApiAiAssistant;
var CHANNELS = new Map([
["Nederland 1", 1],
["Nederland 2", 2],
@savelee
savelee / videointelligence.js
Last active November 19, 2017 16:55
Google Cloud Function - On video upload, detect tags with Video Intelligence API
/**
{
kind: 'storage#object',
resourceState: 'exists',
id: 'leeboonstra-videoapi/mov_bbb.mp4/1490796080783211',
selfLink: 'https://www.googleapis.com/storage/v1/b/leeboonstra-videoapi/o/mov_bbb.mp4',
name: 'mov_bbb.mp4',
bucket: 'leeboonstra-videoapi',
generation: '1490796080783211',
metageneration: '1',