Skip to content

Instantly share code, notes, and snippets.

@marcorei
Created December 31, 2017 10:57
Show Gist options
  • Save marcorei/46a096348355155dcd5e72fd521dcfb9 to your computer and use it in GitHub Desktop.
Save marcorei/46a096348355155dcd5e72fd521dcfb9 to your computer and use it in GitHub Desktop.
import { Request, Response } from 'express'
import { DialogflowApp } from 'actions-on-google'
// Import actions here.
export function createDialogflowApp(request: Request, response: Response) {
const dialogflowApp = new DialogflowApp({request, response})
interface Action {
name: string,
handler: (app: DialogflowApp) => void
}
const actions: Action[] = [
// Add actions here.
]
const actionMap = new Map()
actions.forEach(action => actionMap.set(action.name, action.handler))
dialogflowApp.handleRequest(actionMap)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment