Skip to content

Instantly share code, notes, and snippets.

View Fleker's full-sized avatar
💻
doing good things

Nick Fleker

💻
doing good things
View GitHub Profile
@Fleker
Fleker / getEmail.js
Created April 30, 2019 00:35
Obtain email address from Auth0
const getEmail = async (headers) => {
const accessToken = headers.authorization.substr(7);
const {email} = await auth0.getProfile(accessToken);
return email;
}
@Fleker
Fleker / index.js
Created April 30, 2019 00:34
Setup Auth0 & AoG
const {AuthenticationClient} = require('auth0');
const auth0 = new AuthenticationClient({
'clientId': 'clientIdentifier',
'domain': '<auth0-tenant-id>.auth0.com'
});
const smarthome = require('actions-on-google');
const app = smarthome({
jwt: require('./service-account-key.json')
});
"search": [{
"name": ".*Conversation.data",
"subtitle": "Session data"
}, {
"name": "conversation/response.*",
"subtitle": "Rich response"
}, {
"name": "conversation.User.storage",
"subtitle": "Persistent storage"
}]
"outline": [{
"Actions SDK": {
"Overview": "actionssdk",
"Conversation": "classes/actionssdk.actionssdkconversation",
"api/v2": "actionssdk_api_v2"
},
"Dialogflow": {
"Overview": "dialogflow",
"Conversation": "classes/dialogflow.dialogflowconversation",
"api/v1": "dialogflow_api_v1",
@Fleker
Fleker / index.js
Created February 5, 2019 16:46
Using Cloud Storage for Firebase for hosting rich media in your Actions
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
const bucket = admin.storage().bucket();
const bucketAccessConfig = {
action: 'read',
expires: Date.now() + 1000 * 60 * 60
};
const {dialogflow, BasicCard, Image} = require(‘actions-on-google’);
@Fleker
Fleker / index.js
Created February 5, 2019 16:45
Using Cloud Storage for Firebase for hosting rich media in your Actions
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
const bucket = admin.storage().bucket();
const bucketAccessConfig = {
action: 'read',
expires: Date.now() + 1000 * 60 * 60
};
const {dialogflow} = require(‘actions-on-google’);
@Fleker
Fleker / index.js
Created February 5, 2019 16:45
Using Cloud Storage for Firebase for hosting rich media in your Actions
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
const bucket = admin.storage().bucket();
const bucketAccessConfig = {
action: 'read',
expires: Date.now() + 1000 * 60 * 60
};
const {dialogflow, Image, MediaObject} = require('actions-on-google');
@Fleker
Fleker / package.json
Created February 5, 2019 16:43
Using Cloud Storage for Firebase for hosting rich media in your Actions
{
...
"engines": {
"node": "8"
},
"dependencies": {
"actions-on-google": "^2.3.0",
"firebase-functions": "^2.0.0",
"firebase-admin": "^6.5.0"
...
@Fleker
Fleker / index.js
Created December 18, 2018 22:48
YouTube Plays Smart Home - Script
'use strict';
const fetch = require('isomorphic-fetch')
const delay = require('delay')
// Get Google Assistant code from https://github.com/googlesamples/assistant-sdk-nodejs
const {GoogleAssistant} = require('./google-assistant')
// Follow instructions in README to generate a credentials file and refer to it here
const assistant = new GoogleAssistant(require('./prod-credentials.json'))