Skip to content

Discussion: Improvements around app.message(...) #465

@seratch

Description

@seratch

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 [ ])

  • bug
  • enhancement (feature request)
  • question
  • documentation related
  • testing related
  • discussion

Requirements (place an x in each of the [ ])

  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've searched for any related issues and avoided creating a duplicate issue.

Metadata

Metadata

Assignees

Labels

discussionM-T: An issue where more input is needed to reach a decisionsemver:major

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions