How do I get hubot to hear a different comment from a Slack integration?

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

Hubot will hear me and another team member, but will not hear the email notification comment. Does anyone know how to solve it?

Thank.

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

      

+3


source to share


3 answers


I understand why Hubot won't work when I read this Japanese article.

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

A summary of this article is provided below.



First, Hubot-slack does not support Bot to Bot. And that will be fixed during this year. (I saw an article a Japanese developer asked about this and he got the answer as above.)

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

+2


source


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

eg.



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'

      

0


source


You can listen to other bot messages using

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

      

0


source







All Articles