Skip to content

Instantly share code, notes, and snippets.

@tristolliday
Created December 17, 2019 09:31
Show Gist options
  • Select an option

  • Save tristolliday/c8f44ad6302576233784a103a6d950f0 to your computer and use it in GitHub Desktop.

Select an option

Save tristolliday/c8f44ad6302576233784a103a6d950f0 to your computer and use it in GitHub Desktop.
Simple Firebase Function for Actions on Google Fulfillment on Dialogflow
'use strict';
// So that you have access to the dialogflow and conversation object
const { dialogflow } = require('actions-on-google');
// So you have access to the request response stuff >> functions.https.onRequest(app)
const functions = require('firebase-functions');
// Create an instance of dialogflow for your app
const app = dialogflow({debug: true});
// Build an intent to be fulfilled by firebase,
// the name is the name of the intent that dialogflow passes over
app.intent('Default Welcome Intent', (conv) => {
// Any extra logic goes here for the intent, before returning a response for firebase to deal with
return conv.ask(`Welcome to a firebase fulfillment`);
});
// Finally we export as dialogflowFirebaseFulfillment so the inline editor knows to use it
exports.dialogflowFirebaseFulfillment = functions.https.onRequest(app);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment