Skip to content

Instantly share code, notes, and snippets.


Lee Boonstra savelee

View GitHub Profile
savelee / index.js
Created January 11, 2023 08:32
Example Dialogflow CX webhook as Node JS cloud function
View index.js
const functions = require('@google-cloud/functions-framework');
// Here's where you set the entry point, it gets the request from Dialogflow CX
// and it holds the response which will be sent back to Dialogflow
functions.http('orderState', (req, res) => {
let msg;
let results = {};
//let item;
//Let's log whatever we receive from Dialogflow CX to understand things better
savelee / actions.js
Created April 12, 2021 11:06
google assistant - for CX agents
View actions.js
"actions": [
"description": "Default Welcome Intent",
"name": "MAIN",
"fulfillment": {
"conversationName": "welcome"
"intent": {
"name": "actions.intent.MAIN",
savelee / actions.json
Last active April 9, 2021 10:21
Actions on Google SDK
View actions.json
"actions": [
"description": "Default Welcome Intent",
"name": "MAIN",
"fulfillment": {
"conversationName": "welcome"
"intent": {
"name": "actions.intent.MAIN",
View chat.dart
import 'dart:async';
import 'package:dialogflow_grpc/v2beta1.dart';
import 'package:dialogflow_grpc/generated/google/cloud/dialogflow/v2beta1/session.pb.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:rxdart/rxdart.dart';
import 'package:sound_stream/sound_stream.dart';
//TODO import Dialogflow
import 'package:dialogflow_grpc/dialogflow_grpc.dart';
savelee /
Last active March 15, 2021 12:05
Generate Google Cloud dart files from protobuffers
#!/usr/bin/env bash
if [ ! -d "$PROTOBUF" ]; then
echo "Please set the PROTOBUF environment variable to your clone of google/protobuf."
exit -1
if [ ! -d "$GOOGLEAPIS" ]; then
echo "Please set the GOOGLEAPIS environment variable to your clone of googleapis/googleapis."
exit -1
savelee / dialogflow_v2.dart
Last active March 8, 2021 11:56
Dialogflow Flutter example
View dialogflow_v2.dart
import 'package:meta/meta.dart';
import 'package:googleapis_auth/auth_io.dart' as auth;
import "package:googleapis/dialogflow/v2.dart";
import 'package:uuid/uuid.dart';
import 'package:flutter/services.dart' show rootBundle;
import 'dart:convert';
class Dialogflow {
final String serviceAccountPath;
savelee / 000-default-le-ssl.conf
Last active May 31, 2021 14:34
SSL / mutual TLS examples
View 000-default-le-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
savelee / .dockerignore
Last active January 31, 2022 20:54
Dialogflow Fulfillment in Cloud Run
View .dockerignore
savelee / index.js
Last active June 17, 2020 09:37
Webhook Example
View index.js
'use strict';
const functions = require('firebase-functions');
process.env.DEBUG = 'dialogflow:debug'; // enables lib debugging statements
function handleRequest(map, request){
let intent;
if(request.body && request.body.queryResult && request.body.queryResult.intent){
intent = request.body.queryResult.intent.displayName;
savelee / index.js
Last active June 17, 2020 09:38
Actions on Google libary
View index.js
'use strict';
const {
} = require('actions-on-google');