bolt-js icon indicating copy to clipboard operation
bolt-js copied to clipboard

`message_replied` subtype doesn't not invoke

Open KevinEdry opened this issue 5 months ago • 6 comments

(Filling out the following with as much detail as you can provide will help us solve your issue sooner.)

@slack/bolt version

4.4.0

Your App and Receiver Configuration

App({
    token,
    signingSecret,
    appToken,
    socketMode: true,
    deferInitialization: true,
    customRoutes: [atlassianAuthCallbackRoute],
  });

Node.js runtime version

Node.js v22.14.0

Steps to reproduce:

(Share the commands to run, source code, and project settings)

  1. listen to the message_replied message subtype.
  2. try to reply in a thread

Expected result:

The expected result would be that the app.message will invoke the callback.

Actual result:

The callback never gets invoked, the app isn't reaching the console.log.

    app.message(subtype('message_replied'), async ({ message, event, context, payload }) => {
      console.log({ message, event, payload, context });
    });

Requirements

For general questions/issues about Slack API platform or its server-side, could you submit questions at https://my.slack.com/help/requests/new instead. :bow:

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

KevinEdry avatar Jun 29 '25 23:06 KevinEdry

Hi, @KevinEdry! Thanks for submitting this issue?

Just to check, are you subscribing to the message_replied event via the Events Subscription page for your app configuration?

hello-ashleyintech avatar Jun 30 '25 18:06 hello-ashleyintech

Hey @hello-ashleyintech, thanks for the quick response.

Image I tried, but it prompts me that there is no such event.

KevinEdry avatar Jun 30 '25 19:06 KevinEdry

Hey @hello-ashleyintech, thanks for the quick response.

Image I tried, but it prompts me that there is no such event.

I believe that the events you can subscribe to are only the "top-level" events. Sub types need to be inferred and handled by your application logic.

If you look at this link you will see that there is a bug alert:

Bug alert! This event is missing the subtype field when dispatched over the Events API. Until it is fixed, examine message events' thread_ts value. When present, it's a reply. To be doubly sure, compare a thread_ts to the top-level ts value, when they differ the latter is a reply to the former.

This may be why your subtype() handler does not pick it up adequately.

Lastly, please verify that you have the necessary scopes for this event: https://api.slack.com/events/message/message_replied#facts

jfbn avatar Jul 04 '25 07:07 jfbn

👋 @jfbn This might be related to https://github.com/slackapi/node-slack-sdk/issues/2025 with the bug alert shared 📚

A workaround of filtering out undefined thread_ts for a message event is included in comment and might be useful here!

zimeg avatar Jul 15 '25 21:07 zimeg

👋 It looks like this issue has been open for 30 days with no activity. We'll mark this as stale for now, and wait 10 days for an update or for further comment before closing this issue out. If you think this issue needs to be prioritized, please comment to get the thread going again! Maintainers also review issues marked as stale on a regular basis and comment or adjust status if the issue needs to be reprioritized.

github-actions[bot] avatar Aug 18 '25 00:08 github-actions[bot]

🗣️ Let's keep this issue open! We might want to add a warning to the subtype handler to avoid confusion during development. A backend change isn't planned in neartimes AFAICT:

https://github.com/slackapi/bolt-js/blob/9337e0616f058f1459ef1ad922dfba38048dac3b/src/middleware/builtin.ts#L343-L352

zimeg avatar Aug 19 '25 17:08 zimeg