Last active
April 18, 2018 00:13
-
-
Save DavidMellul/eb4ad9341d8c1e27f79e8364ae87f484 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
| // Dependencies | |
| const express = require('express'); | |
| const bodyparser = require('body-parser'); | |
| // Configuration | |
| const app = express(); | |
| app.use(bodyparser.json()); | |
| // Webhook route | |
| app.post('/webhook', (req, res) => { | |
| const data = req.body; | |
| // Code the task you want to achieve with @data | |
| // Read the v2 api documentation of dialogflow : https://dialogflow.com/docs/fulfillment | |
| // Using the v2 will become mandatory, Google wrote a guide to migrate from v1 to v2 as v2 is officially released | |
| const response = { | |
| fulfillmentText: "Your webhook works fine !", | |
| } | |
| res.json(response); | |
| }); | |
| // Logic for running your server with HTTPS here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment