Hi ,
I'm using bolt v1.5 to create slack app with home tab . I need when user mentions my app (ex: @my_app) it replies with an interactive message for list of commands used . I tried to implement app_mention event but it didn't work (the event is not firing ) although i added app_mention:read at Bot Token scopes permissions .
Am i missing something at permissions or i'm using the wrong event ?
Regards ,
Marwa
Describe your issue here.
x in one of the [ ])x in each of the [ ])Filling out the following details about bugs will help us solve your issue sooner.
package version:
node version:
OS version(s):
1.
2.
3.
What you expected to happen
What actually happened
Logs, screenshots, screencast, sample project, funny gif, etc.
@MarwaAbuEssa Hey there πIs your app in the channel where it's being mentioned? The app_mentions:read scope only fires when it is in the channel.
hi @shaydewael ,
the app is installed in a certain channel and yes i'm trying to mention the app at app's messages tab . is there any other event to use ?
Thanks
@MarwaAbuEssa It seems that app_mentions:read only allows your app to listen to public channels. To listen to messages within your app's messages tab, you'll have to subscribe to the message.im event.
In Bolt, if you wanted to filter out messages that mention your app, you could write a handler similar to this:
app.message('@APP_ID', ({ context, payload }) => {
console.log(payload);
});
hi @shaydewael
unfortunate , it didn't work
here is a list of all scopes and permissions added to my app
Bot Token Scopes
User Token Scopes
Thanks a lot for your help
Hmm that's weird π€ What events are you subscribed to (under the Event Subscriptions tab)? I got the code example I posted to work locally
HI @shaydewael i know it's weird indeed π


may be because Subscribe to events on behalf of users is empty ?
Thanks in advance
@MarwaAbuEssa Looks like you're subscribed to the correct events β you shouldn't have to subscribe to any Workspace Events. Is your app receiving any events at all? If not, you may want to double-check your Request URL at the top of that page. Bolt always listens at the /slack/events endpoint, so if my app was hosted at https://sample-app.ngrok.io, my Request URL would be http://sdewael-bolt.ngrok.io/slack/events.
Although if you're adding events, I assume your Request URL is verified and working. Is there any information in the Bolt logs (like errors, or warning messages)?
hi @shaydewael ,
yes i'm receiving app_home_opened event which is working perfectly with all event data. also i'm using 3 commands and it is working perfectly .!! .
well the console log at event function (for app mention of app.message) is not logging anything as if it didn't goes into the function at all and also the console is not throws any error . may be i should add try and catch and try it again and kindly send me if you have any news.
Thanks in advance
@MarwaAbuEssa Adding the following code (a middleware for debug logging) in your app may be helpful. The debug log captures all incoming requests from Slack. You can check if your app is properly configured to receive those events more easily.
app.use(args => {
const copiedArgs = JSON.parse(JSON.stringify(args));
copiedArgs.context.botToken = 'xoxb-***';
if (copiedArgs.context.userToken) {
copiedArgs.context.userToken = 'xoxp-***';
}
copiedArgs.client = {};
copiedArgs.logger = {};
args.logger.info(
"Dumping request data for debugging...\n\n" +
JSON.stringify(copiedArgs, null, 2) +
"\n"
);
args.next();
});
hi @seratch ,
Thanks a lot i will add the debugging code and see the results
hi @shaydewael ,
It worked now !! its my mistake , when you send me the code app.message('@APP_ID', ({ context, payload }) => {
console.log(payload);
}); i was adding @app_name at the param not @app_uniqueid which is the app id actually π i'm so sorry for inconvenience .
hi @seratch , thank you so much for the logger code , i wish i had it long time ago π π
Thanks a lot for your awesome support .
Glad you got it working @MarwaAbuEssa π
Most helpful comment
Glad you got it working @MarwaAbuEssa π