Skip to content

Instantly share code, notes, and snippets.

@xVir
Created August 2, 2016 10:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xVir/133b65156f4a98586aa78e4cd60d774f to your computer and use it in GitHub Desktop.
Save xVir/133b65156f4a98586aa78e4cd60d774f to your computer and use it in GitHub Desktop.
Webhook for bots
'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