Reputation: 2277
Im currently hosting the Slackbot on IBM cloud. Everything works fine until I want to add Interactive messages.
This is a part of the documentation
In order to use interactive messages, your bot will have to be registered as a Slack application, and will have to use the Slack button authentication system. To receive callbacks, register a callback url as part of applications configuration. Botkit's built in support for the Slack Button system supports interactive message callbacks at the url https://_your_server_/slack/receive Note that Slack requires this url to be secured with https.
So what I understod is the BOTKIT creates an Request URL I can use. in this case https://_my_ibm_cloud_url_/slack/receive
But of course this does not work, otherwise I wouldn't be here :)
Does anybody have an idea?
This is how it's setup at the moment.
server.js
require('dotenv').load();
var express = require('express');
var bodyParser = require('body-parser');
var verify = require('./security');
var app = express();
app.use(bodyParser.json({
verify: verify
}));
var port = process.env.PORT || 5000;
app.set('port', port);
require('./app')(app);
// Listen on the specified port
app.listen(port, function() {
console.log('Client server listening on port ' + port);
});
app.js
require('dotenv').load();
var middleware = require('botkit-middleware-watson')({
iam_apikey: process.env.ASSISTANT_IAM_APIKEY,
workspace_id: process.env.WORKSPACE_ID,
url: process.env.ASSISTANT_URL || 'https://gateway.watsonplatform.net/assistant/api',
version: '2018-07-10'
});
module.exports = function(app) {
if (process.env.USE_SLACK) {
console.log('test')
var Slack = require('./bot-slack');
Slack.controller.middleware.receive.use(middleware.receive);
Slack.bot.startRTM();
console.log('Slack bot is live');
}
bot-slack.js
var Botkit = require('botkit');
var controller = Botkit.slackbot();
controller.configureSlackApp({
clientId: process.env.SLACK_CLIENTID,
clientSecret: process.env.SLACK_CLIENT_SECRET,
});
var bot = controller.spawn({
token: process.env.SLACK_TOKEN
});
controller.hears(['.*'], ['direct_message', 'direct_mention', 'mention'], function(bot, message) {
bot.replies....
});
module.exports.controller = controller;
module.exports.bot = bot;
Upvotes: 0
Views: 603
Reputation: 91
It doesn't look like you've called the configureIncomingWebhook method to create the actual webhook endpoint. See the docs below:
https://botkit.ai/docs/readme-slack.html#botconfigureincomingwebhook
Upvotes: 1