Botkit: Any reason why bots don't hear other bots in slack?

Created on 18 Jun 2016  路  4Comments  路  Source: howdyai/botkit

I have a few integrations for apps like GitHub and Heroku, which all post to my slack channels as bots, but it seems like Botkit doesn't receive these.

Nothing on any of these events:
controller.hears('','message_received,direct_message,direct_mention,mention,ambient',function(slackBot,message) {
...
});
Any ideas?

Botkit 0.2.1 on OSX

Slack-related question

Most helpful comment

Try listening for the 'bot_message' event

All 4 comments

Try this 馃槂

controller.hears('(.*)',['message_received','direct_message','direct_mention','mention','ambient'],function(bot,message) {
...
});

@nobukatsu thanks for the response, but still doesn't seem to invoke the event.

var Botkit = require('botkit');
var slackBotToken = 'TOKEN-HERE';
var controller = Botkit.slackbot();
var slackBot = controller.spawn({
    token: slackBotToken
});

slackBot.startRTM(function(err,bot,payload) {
    if (err) {
        throw new Error('Could not connect to Slack');
    }
});

controller.hears('(.*)',['message_received','direct_message','direct_mention','mention','ambient'],function(slackBot,message) {
    console.log(message);
    console.log(message.text);
});

Try listening for the 'bot_message' event

@anhuynh Thanks, that worked.

controller.on('bot_message', function(bot, message) {
...
});
Was this page helpful?
0 / 5 - 0 ratings