Skip to content

Instantly share code, notes, and snippets.

Lee Boonstra savelee

Block or report user

Report or block savelee

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
@savelee
savelee / index.html
Created Dec 6, 2019
A best practice for streaming audio from a browser microphone to Dialogflow or Google Cloud STT by using websockets.
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>RecordRTC over Socket.io</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script src="https://www.WebRTC-Experiment.com/RecordRTC.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.3.0/socket.io.js"></script>
@savelee
savelee / index.js
Last active Oct 28, 2019
simple tv guide feed
View index.js
const TVGUIDE_WEBSERVICE = 'https://tvguide-f36xvzb5da-ew.a.run.app/channel';
const { WebhookClient } = require('dialogflow-fulfillment');
const rp = require('request-promise');
const moment = require('moment');
process.env.DEBUG = 'dialogflow:debug'; // enables lib debugging statements
exports.tvguide = function(request, response){
var agent = new WebhookClient({ request, response });
@savelee
savelee / feed.js
Created May 28, 2019
tvguide feed
View feed.js
'use strict';
const local = {
"1": [{
"titel": "Journaal",
"datum_start": "2018-07-26 15:00:00"
}, {
"titel": "Journaal",
"datum_start": "2018-07-26 15:20:00"
}, {
@savelee
savelee / chatserver-node.js
Last active Feb 27, 2019
Example Dialogflow implementation, branching on parameters and returning text strings
View chatserver-node.js
require('dotenv').config() //load environemnt vars
const projectId = process.env.GCLOUD_PROJECT; //your project name
const uuidv1 = require('uuid/v1');
const sessionId = uuidv1();
const languageCode = 'en-US';
const server = require('http').createServer((request, response) => {
response.writeHead(200, {"Content-Type": "text/html"});
@savelee
savelee / index.js
Created Oct 25, 2018
tvguide index.js
View 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 Sep 25, 2018
Actions on Google starter template (firebase)
View _index.js
'use strict';
const functions = require('firebase-functions');
const {
dialogflow,
Suggestions,
Image,
BasicCard,
MediaObject,
List,
@savelee
savelee / index.js
Last active May 25, 2019
Conditional Templating in Dialogflow with Custom Payloads and Google Cloud Functions
View index.js
'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 May 20, 2018
Actions on Google for Google Cloud Functions
View app.js
'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
Firebase TV Guide assistant
View index.js
// 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 Oct 17, 2018
V2 - TV Guide
View index.js
{
"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": {
You can’t perform that action at this time.