-
Notifications
You must be signed in to change notification settings - Fork 395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
member_joined_channel event not firing for own bot #225
Comments
I'm seeing the same issue. Also, I noticed in NgRok admin panel that requests are making into And one more thing, when |
Alright, since no one doesn't want to look at this question I figured out it by myself. Here is the line which is causing the issue. Fix 1 (Long and hard) Fix 2 (No one knows what can happen) const app = new App({
token: process.env.SLACK_BOT_TOKEN,
signingSecret: process.env.SLACK_SIGNING_SECRET,
ignoreSelf: false,
}); Fix 2 works perfectly for me, but it's unclear why do we need that if (in @YanivSilberman, ^^ |
@TK95 I'm sorry that we hadn't responded to this issue sooner, that's our bad. I can add some useful context. By default, Bolt apps ignore events that come from itself. This is really useful in situations when your app sends a message and you don't expect your own message listeners to be triggered (what most people would expect). It's not what you want for most other kinds of events. The Okay, done with context. What do I think about this issue? When a I'd be surprised if it was the line you pointed to (L228) that caused this issue. In fact, that code is contained in a condition that says Instead, I think the culprit might be the following lines: https://github.com/slackapi/bolt/blob/522e70b381cf3d18a88b7ca271dcfb4f0ce1be9b/src/middleware/builtin.ts#L233-L236 That code will make |
Hi @aoberoi Thank you for your answer! It's really helpful. And regarding the code, you're right. These lines are causing the issue: Sorry, I provided the wrong line in my previous message :( My fix was: // Its an Events API event that isn't of type message, but the user ID might match our own app. Filter these out.
const isMemberLeftOrJoined = ["member_joined_channel", "member_left_channel"].includes(args.event.type);
if (botUserId !== undefined && args.event.user === botUserId && !isMemberLeftOrJoined) {
return;
} Which is exactly what you suggested:
I think the best available solution, is setting |
Just writing in case it helps anyone else: |
Description
My bot is subscribed to the member_joined_channel event, which fires successfully for all group invite events except for my own bot. It works for inviting other users and other bots. I tried it with the @slack/events-api and it worked for my bot, I'm not sure why it doesn't with Bolt. Authorize runs successfully during this event.
Cheers
What type of issue is this? (place an
x
in one of the[ ]
)Requirements (place an
x
in each of the[ ]
)Bug Report
Filling out the following details about bugs will help us solve your issue sooner.
Reproducible in:
package version: 1.2
node version: 10.16.0
Expected result:
What you expected to happen
Actual result:
What actually happened
Attachments:
Logs, screenshots, screencast, sample project, funny gif, etc.
The text was updated successfully, but these errors were encountered: