Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

bot_channel_join event not firing when bot is invited to a channel #347

Closed
groppe opened this issue Jul 29, 2016 · 16 comments · Fixed by #514
Closed

bot_channel_join event not firing when bot is invited to a channel #347

groppe opened this issue Jul 29, 2016 · 16 comments · Fixed by #514

Comments

@groppe
Copy link

groppe commented Jul 29, 2016

I am listening to the bot_channel_join event as follows:

controller.on('bot_channel_join',
    function(bot, message) {
        console.log(message);

        // reply with excitement
        bot.reply(message, It\'s me!!');
});

However, when I invite the bot to a channel the event doesn't fire.

@davidrussell731
Copy link

davidrussell731 commented Aug 3, 2016

I'm having the same issue with this, as well as the user_channel_join event.

@ghost
Copy link

ghost commented Oct 19, 2016

Maybe you need to use bot_group_join and user_group_join instead.

@dipesh-gandhi
Copy link

Same here, tried both user_channel_join and bot_channel_join but they don't fire.

@jonchurch
Copy link
Contributor

@dipesh-gandhi Are you using the latest botkit? version 4.2? Events API or RTM?
I am looking into this currently.

@dipesh-gandhi
Copy link

Yes, it's latest 4.2 version. Events API. I'm using console bot at moment for testing.

image

@jonchurch
Copy link
Contributor

Events API does not send bot_id fields with channel_join or group_join events, which Slackbot.js looks for. I have removed the check for bot_id and added channel_join and group_join as exceptions to the check for events originated by the bot (which are ignored by default).

Here is a link to the lines I changed.

Will submit a PR for this after coming back and looking at that exception again 👍
Good catch @dipesh-gandhi!

@dipesh-gandhi
Copy link

@jonchurch Thanks much for looking into this, especially since its around holidays. :) The fix you propose seems to be specific to Slack? I'm using Console Bot at moment but I tried regardless, and no luck. I'm fairly new to Botkit so you can correct me.. My goal is for Bot to sent initial greeting message from bot in either case when user joins bot / bot joins user. This is regardless of interface slack, sms, console, web chat, etc. I was thinking there would be some events triggered at bot core, an abstraction?

@jonchurch
Copy link
Contributor

Hmm the concept of channel joins is slack specific Im fairly sure. I honestly have not used console bot yet, but will test it today.

So to be clear, you made the changes to Slackbot.js but are still not receiving bot_channel_join events?

@jonchurch
Copy link
Contributor

jonchurch commented Nov 26, 2016

Not a solution, just another option, but when a bot is added to a slack team an event called create_bot is fired, for facebook user_optin is fired when a user clicks get started. For slack this would give you the opportunity to send instructions or welcome message to whoever added the bot to the team, for facebook its when your user first interacts with the bot.

This is the intended way to greet users on setup.

But it seems to me you are trying to have the bot say hello when it joins a users channel or vice versa, correct?

@jonchurch
Copy link
Contributor

@dipesh-gandhi Currently with ConsoleBot you can only test text input and conversations. There is not a way to tigger events such as bot_channel_join.

There should be though! I will look into adding something.

Be aware, however, that bot_channel_join is Slack specific

@dipesh-gandhi
Copy link

@jonchurch Thanks dude!

@bertiful
Copy link

bertiful commented Dec 9, 2016

I am having this issue as well - Botkit version 0.4.3 (not using ConsoleBot).

@bertiful
Copy link

bertiful commented Dec 9, 2016

@jonchurch It works as far as 0.2.2, once I hit 0.4 it stops working. Also, for context, I am not inviting the bot into a private channel and I'm running:

controller.on('bot_channel_join', function(bot, message) {
  bot.reply(message, 'Yay, I have arrived!');
});

@jonchurch
Copy link
Contributor

@chrisberthe Take a look at #514

@JimLynchCodes
Copy link

@jonchurch @benbrown

Are you sure this was fixed? bot_channel_join event is not ever firing for me...

@Laptopmini
Copy link

Laptopmini commented May 7, 2019

@JimTheMan +1, not working here either. v0.7.4. Reopened under #1640.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants