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
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) {
...
});
Most helpful comment
Try listening for the 'bot_message' event