Proposal
As described at #463, app.message(...)'s behavior with the latest payloads is not intuitive for developers. It's surprising for developers to receive more events than the number of messages in a channel.
I propose to change the behavior to receive only message typed events that don't have a subtype. With this, Bolt apps can receive only events telling the arrival of new messages.
Also. there is one additional thing we may need to care about in the future. As far as I know, the server-side no longer sends bot_message subtyped events. Instead, it sends no-subtype events with bot_id and bot_profile properties. If the server-side gets back to the previous behavior in the future, we may need to add bot_message events as well.
For reference: @aoberoi 's slackapi/hubot-slack#589
What happened to the subtype: 'bot_message'? It seems to be missing on at least some, but maybe all, events where it should be.
References
The list of sutyped message events
There are a number of subtype events for messages. Some of them may have a quite different data structure compared with message typed events without a subtype.
bot_message
ekm_access_denied
me_message
message_changed
message_deleted
message_replied
reply_broadcast
thread_broadcast
Bolt for Java's approach
Bolt for Java's app.message listeners receive only message events that don't have a subtype.
https://github.com/slackapi/java-slack-sdk/blob/v1.0.3/bolt/src/main/java/com/slack/api/bolt/App.java#L509-L526
There are two reasons for that. It's technically impossible to include other events due to the Reason 2.
Regarding bot_message events, Bolt doesn't invoke listeners given to app.message due to the difference in the structure of payloads. If the server-side is changed in the future, Bolt for Java may need to consider introducing a new routing method.
What type of issue is this? (place an x in one of the [ ])
Requirements (place an x in each of the [ ])
Proposal
As described at #463,
app.message(...)'s behavior with the latest payloads is not intuitive for developers. It's surprising for developers to receive more events than the number of messages in a channel.I propose to change the behavior to receive only
messagetyped events that don't have a subtype. With this, Bolt apps can receive only events telling the arrival of new messages.Also. there is one additional thing we may need to care about in the future. As far as I know, the server-side no longer sends
bot_messagesubtyped events. Instead, it sends no-subtype events withbot_idandbot_profileproperties. If the server-side gets back to the previous behavior in the future, we may need to addbot_messageevents as well.For reference: @aoberoi 's slackapi/hubot-slack#589
References
The list of sutyped
messageeventsThere are a number of subtype events for messages. Some of them may have a quite different data structure compared with
messagetyped events without a subtype.bot_messageekm_access_deniedme_messagemessage_changedmessage_deletedmessage_repliedreply_broadcastthread_broadcastBolt for Java's approach
Bolt for Java's
app.messagelisteners receive onlymessageevents that don't have a subtype.https://github.com/slackapi/java-slack-sdk/blob/v1.0.3/bolt/src/main/java/com/slack/api/bolt/App.java#L509-L526
There are two reasons for that. It's technically impossible to include other events due to the Reason 2.
textMessageEventclass in this line is a representation ofmessagetyped event without any subtype. Other events with subtype look like this.Regarding
bot_messageevents, Bolt doesn't invoke listeners given toapp.messagedue to the difference in the structure of payloads. If the server-side is changed in the future, Bolt for Java may need to consider introducing a new routing method.What type of issue is this? (place an
xin one of the[ ])Requirements (place an
xin each of the[ ])