Skip to content

Instantly share code, notes, and snippets.

@savelee
Last active August 18, 2022 09:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save savelee/7485763b67e6ee3a5d00aa07c8678f94 to your computer and use it in GitHub Desktop.
Save savelee/7485763b67e6ee3a5d00aa07c8678f94 to your computer and use it in GitHub Desktop.
Actions on Google for Google Cloud Functions
'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));
conv.ask("Hello World");
};
const welcomeHandler = (conv) => {
conv.ask("Welcome");
};
const app = dialogflow();
app.intent('Welcome Intent', welcomeHandler);
app.intent('My Custom Intent', assistantHandler);
exports.index = app;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment