Skip to content

Instantly share code, notes, and snippets.

@frogermcs
Last active November 5, 2017 11:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frogermcs/c0fd3782155c243bd0832edb76883dd6 to your computer and use it in GitHub Desktop.
Save frogermcs/c0fd3782155c243bd0832edb76883dd6 to your computer and use it in GitHub Desktop.
//assistant-actions.js
module.exports = {
//...
ACTION_UPDATE_SETTINGS: 'update_settings',
ACTION_USER_DATA: 'user_data'
};
//index.js
exports.waterLog = functions.https.onRequest((request, response) => {
//...
//Define map of Dialogflow agent Intents
let actionMap = new Map();
//...
actionMap.set(Actions.ACTION_UPDATE_SETTINGS, () => conversation.actionUpdateSettings());
actionMap.set(Actions.ACTION_USER_DATA, () => conversation.actionUserData());
//Handle request from Dialogflow (will be dispatched into appropriate action defined above)
dialogflowApp.handleRequest(actionMap);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment