Created
December 31, 2017 10:57
-
-
Save marcorei/46a096348355155dcd5e72fd521dcfb9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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