Created
June 24, 2020 04:51
-
-
Save velotiotech/6b5dceb2c3045044e0688ccd4c0a0a97 to your computer and use it in GitHub Desktop.
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
let Botkit = require('botkit'); | |
let rasa = require('./Middleware/rasa')({rasa_uri: 'http://localhost:5000'}); | |
let controller = Botkit.slackbot({ | |
clientId: process.env.clientId, | |
clientSecret: process.env.clientSecret, | |
scopes: ['bot'], | |
json_file_store: __dirname + '/.db/' | |
}); | |
// Override receive method in botkit | |
controller.middleware.receive.use(rasa.receive); | |
// Override hears method in botkit | |
controller.changeEars(function (patterns, message) { | |
return rasa.hears(patterns, message); | |
}); | |
controller.setupWebserver(3000, function (err, webserver) { | |
// Configure a route to receive webhooks from slack | |
controller.createWebhookEndpoints(webserver); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment