Closed Allist closed 6 months ago
I can confirm this issue. I have an app_mention event handler defined in my Bolt for Java app. When a user app-mentions my bot, the app_mention handler executes as expected. However, when I built a workflow to at-mention my bot, the following logs show up:
[socket-mode-message-processor-worker-32] WARN com.slack.api.bolt.App - No BoltEventHandler registered for event: app_mention:bot_message
---
[Suggestion] You can handle this type of event with the following listener function:
app.event(AppMentionBotEvent.class, (payload, ctx) -> {
return ctx.ack();
});
[socket-mode-message-processor-worker-32] DEBUG com.slack.api.bolt.App - The handler completed (request type: Event)
[socket-mode-message-processor-worker-32] WARN com.slack.api.bolt.socket_mode.SocketModeApp - Unsuccessful Bolt app execution (status: 404, body: {"error":"no handler found"})
I think the underlying cause of the issue is that ONLY in the case that a non-human creates the app mention event, the event contains a subtype
- which surprised me (I thought only message events contain those, which is what is described in our docs). I tested this scenario out (a workflow that at-mentions a Bolt app) and the type
of such an event is app_mention
and the subtype
is bot_message
. A human app-mention event has no subtype
.
The suggestion you saw in the logs comes from this area of the code. This, in turn, assembles the specific event class Bolt suggests to listen for using the toEventClassName
.
I think this is a bug, but it is unclear to me whether this is a bug in the above toEventClassName
only or something deeper. Specifically, I would expect a registered app-mention handler to be able to handle BOTH human and non-human app mentions. In fact, this is the case in Bolt for JS. Another thing to consider when evaluating this is that there are no app_mention event subtypes that apps on the api.slack.com/apps page can register to; there is only one event.
@seratch what is your opinion here? Do you agree with my assessment?
Reproducible in:
The Slack SDK version
1.29.2
Java Runtime version
OS info
-
Steps to reproduce:
app.event(AppMentionBotEvent.class, (payload, ctx) -> { return ctx.ack(); });
2024-01-30 11:36:13.783 WARN 116277 --- [socket-mode-message-processor-worker-71] c.s.api.bolt.socket_mode.SocketModeApp : Unsuccessful Bolt app execution (status: 404, body: {"error":"no handler found"})