Kohei Tabata
Kohei Tabata

Reputation: 585

How to make hubot hear other integration comment on Slack?

I wrote coffee script like below to integrate mailchimp and other service on Slack using Hubot.

Hubot do hear me and other team member comment, but won't hear mailchimp notification comment. Anyone know how to solve it?

Thank you.

module.exports = (robot) ->
   robot.hear /^(.*)( foo bar)$/i, (msg) ->
     #Do something

Upvotes: 4

Views: 887

Answers (3)

coderbyheart
coderbyheart

Reputation: 113

You can listen to other bot's messages by using

controller.on('bot_message', function (bot, message) {
    console.log('message', message);
    var attachment = message.attachments[0];
    console.log('attachment', attachment);
});

Upvotes: 1

Erik
Erik

Reputation: 870

There's an ugly-ish workaround: SlackBot, Slacks native bot is heard by hubot. And it's a simple POST request to make it say something to a channel that your hubot can respond to.

E.g.

curl --data "\@hubot asci me OMG from SlackBot" 'https://my.slack.com/services/hooks/slackbot?token=<YOUR_SLACK_TOKEN>&channel=%23channel_that_hubot_is_in'

Upvotes: 0

Kohei Tabata
Kohei Tabata

Reputation: 585

I understand the reason why Hubot won't work when I read this Japanese Article.

http://qiita.com/Vexus2/items/aaf87212e7239132446b

Summary of this article is as below.

First, Hubot-slack don't support Bot to Bot. And It will be fixed within this year. (I saw an article which a Japanese developer asked support desk about this, and he received reply as above.)

Secondary, If you can't wait that modification, you should use Hubot-IRC adapter and Slack IRC instead of Hubot-Slack.

Upvotes: 3

Related Questions