Created
August 2, 2016 10:10
-
-
Save xVir/133b65156f4a98586aa78e4cd60d774f to your computer and use it in GitHub Desktop.
Webhook for bots
This file contains 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
'use strict'; | |
const express = require('express'); | |
const bodyParser = require('body-parser'); | |
const restService = express(); | |
restService.use(bodyParser.json()); | |
restService.post('/webhook', (req, res) => { | |
console.log('hook request'); | |
return res.json({ | |
speech: "This is speech", | |
displayText: "This is speech", | |
data: { | |
facebook: { | |
text: "Facebook message" | |
}, | |
slack: { | |
text: "Slack message" | |
}, | |
telegram: { | |
text: "Telegram message" | |
} | |
}, | |
source: 'apiai-integrations' | |
}); | |
}); | |
restService.listen((process.env.PORT || 5000), ()=> { | |
console.log("Server listening") | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment