Botkit: Can not fire the event if the sender is other kind of Bot

Created on 28 Dec 2015  路  8Comments  路  Source: howdyai/botkit

I use Google Calendar Bot (http://slackhq.com/post/124767707715/googlecalendar) from Slack in order to send the message to my bot.

But the botkit did not fire the event.

controller.on('direct_message',function(bot,message) {
// Do something here
});

It only work if the real person send a message

Most helpful comment

@gdcohan Finally I can get the attachments content with below code:

javascript controller.on('bot_message', function(bot, message) { console.log('message.attachments: ' + message.attachments); var attachment = message.attachments[0]; console.log('attachments.title: ' + attachment.title); console.log('attachments.text: ' + attachment.text); });```

All 8 comments

Finally I can use bot_message event

controller.on('bot_message', function(bot, message) {
    // Do something here
});

There was a problems that message.text always return null.

@ZuzooVn I was hitting this problem too..in my case, the bot was sending a message that had no text but an attachment field with a fallback in it..maybe yours is doing something like this too?

@gdcohan Me too, we can not get the text because the bot did not send any text. Can you get the text in the attachment in below image?

screen shot 2015-12-28 at 4 51 16 pm

@gdcohan According to https://api.slack.com/events/message/bot_message, I think we can not get the attachments content.

@gdcohan Finally I can get the attachments content with below code:

javascript controller.on('bot_message', function(bot, message) { console.log('message.attachments: ' + message.attachments); var attachment = message.attachments[0]; console.log('attachments.title: ' + attachment.title); console.log('attachments.text: ' + attachment.text); });```

Did bot_message go away? I don't see it anywhere in the code and it's not fired when I receive a message from another bot.

@donavon The above code snippet works for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stelio picture stelio  路  4Comments

TheJimFactor picture TheJimFactor  路  4Comments

koubenecn picture koubenecn  路  3Comments

simpixelated picture simpixelated  路  3Comments

fieldcorbett picture fieldcorbett  路  4Comments