slackapi/bolt-js

`files` property missing in `app_mention` event

Closed this issue · 3 comments

I'm working with message and app_mention events and noticed the files field is missing from the AppMentionEvent interface, despite being present in the actual app_mention event payload and in message events of type GenericMessageEvent. Since the payloads for app_mention and message events are nearly identical except for the event type, I'm considering extending the AppMentionEvent interface locally to include files.
Could you confirm if it's possible to officially add the files property to the AppMentionEvent interface for consistency?

Reproducible in:

The Slack SDK version

    "@slack/bolt": "^3.17.0",
    "@slack/web-api": "^6.11.2",

Node.js runtime version

v18.19.0

OS info

ProductName: macOS
ProductVersion: 14.0
BuildVersion: 23A344
Darwin Kernel Version 23.0.0: Fri Sep 15 14:43:05 PDT 2023; root:xnu-10002.1.13~1/RELEASE_ARM64_T6020

Steps to reproduce:

event.files is missing in app_mention event

app.event("app_mention", async ({ event, body, say, client, context }) => {
  if (event.bot_id === context.botId) return
  console.log(event.files)
})

I can access event.files in message event

app.event("message", async ({ event, body, context }) => {
  if (event.type !== "message" || event.subtype !== undefined) return
  console.log(event.files)
})

Expected result:

event.files property is available in app_mention event.

Actual result:

Property 'files' does not exist on the type 'AppMentionEvent'

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. 🙇

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

Hi @thefron, thanks for taking the time to report this issue! You're right that the property should be added in the type definition. We will add the property in the next release.

@seratch Thank you for the quick action and addressing the issue! Looking forward to the next release. Your support is greatly appreciated!

Sorry for the delay here but this fix is now live in bolt v3.18.0.