Bot scopes in the app constructor do not match app manifest settings
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 445
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 28
Description
My bot listens for and responds to certain keywords:
app.message(/^(next steps|status|summary)$/, approvals.summarizeChannel);
My first use case involved the bot creating a private channel, inviting users, posting messages in that channel, and then receiving those keywords. Everything works great.
My next use case involves the bot positing to an existing public channel, and listening for those same keywords on the thread. The bot can post to the public channel, but does not receive the message notifications on the thread, or for any message in the public channel. I have confirmed that my bot is a "member" of the channel; it is listed in the integrations tab of the channel info popup, and has posted to the channel.
As an additional debugging step, I added a handler to log all messages:
app.event('message', (event) => {
console.log("event: ", event);
})
This fires every time a user posts to a private channel created by my bot, or replies in a thread to a post in that channel, but it never fires when a user posts to the public channel where the bot is a member, or to the thread which the bot posted.
I've checked my subscribed event types; here's the relevant part of my manifest:
"bot_events": [
"app_home_opened",
"message.channels",
"message.groups",
"message.im",
"message.mpim"
]
And my scopes, also from the manifest:
"scopes": {
"bot": [
"channels:history",
"channels:join",
"channels:read",
"channels:write.invites",
"channels:manage",
"chat:write",
"commands",
"groups:history",
"groups:read",
"groups:write",
"im:history",
"mpim:history",
"users.profile:read",
"users:read",
"users:read.email"
]
}
I believe I should need the message.channels event and the channels.history scope to get messages from a public group where my bot is a member, and I have both. I'm not sure what else to check.
@slack/bolt version
4.2.0
Your App and Receiver Configuration
const expressReceiver = new ExpressReceiver({
endpoints: '/slack/events',
signingSecret: process.env.SLACK_SIGNING_SECRET,
logLevel: LogLevel.DEBUG,
});
const app = new App({
authorize: oauth.authorizeHandler,
receiver: expressReceiver,
logLevel: LogLevel.DEBUG,
});
Node.js runtime version
v20.17.0
Steps to reproduce:
I cannot publish all of my code due to corporate IP, but as my description above outlines, the basic issue is:
- Have bot create a private channel and post there.
- Have bot join a public channel and post there.
- Listen via
app.message(). - Have a user post to both channels
Expected result:
Bot should see both user messages
Actual result:
Bot only sees message in private channel
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the App constructor and authorize handler configuration, then compare how app.message() and app.event('message') process public-channel versus private-channel events. Review the manifest's bot_events and bot scopes against the reported reproduction, and verify completion when user messages from both channel types reach the handlers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100