It looks like, from just what you've provided, that you're not defining app
inside an HTTPS handler. The DialogflowApp
constructor expects to be passed a request and response object that are sent by an Express-like node.js handler. If you are using Google Cloud Functions or Firebase Cloud Functions, these will be what are available in your function handler.
So if you're using Firebase Cloud Functions, it might look something like this:
const DialogflowApp = require('actions-on-google').DialogflowApp;
const WELCOME_INTENT = 'input.welcome'; // the action name from the Dialogflow intent
const NUMBER_INTENT = 'input.number'; // the action name from the Dialogflow intent
const NUMBER_ARGUMENT = 'input.mynum'; // the action name from the Dialogflow intent
// You will use the action name constants above as keys for an "actionMap"
// with the value being a function that implements each action.
let actionMap = new Map();
// TODO - you need to do this part.
const functions = require('firebase-functions');
exports.webhook = functions.https.onRequest( (request,response) => {
const app = new DialogflowApp({request: request, response: response});
app.handleRequest( actionMap );
});