Skip to content

Instantly share code, notes, and snippets.

@frogermcs frogermcs/index.js
Created Oct 26, 2017

What would you like to do?
exports.waterLog = functions.https.onRequest((request, response) => {
//Initialise app dependencies
const dialogflowApp = new DialogflowApp({request, response});
const userManager = new UserManager(firebase);
const waterLog = new WaterLog(firebase, userManager);
const conversation = new Conversation(dialogflowApp, userManager, waterLog);
//Define map of Dialogflow agent Intents
let actionMap = new Map();
actionMap.set(Actions.ACTION_WELCOME, () => conversation.actionWelcomeUser());
actionMap.set(Actions.ACTION_LOG_WATER, () => conversation.actionLogWater());
actionMap.set(Actions.ACTION_GET_LOGGED_WATER, () => conversation.actionGetLoggedWater());
//Handle request from Dialogflow (will be dispatched into appropriate action defined above)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.