This work implements ThreadBroadcastMessageEvent is missing `files`, `upload`, `display_as_bot` and `parent_user_id` (closed)
Package
@slack/types
SDK Version
@slack/[email protected]
Node.js Version
N/A (type definition issue)
Operating System
No response
Steps to Reproduce
- Set up an app subscribed to the
message.channelsevent. - Start a thread in a channel where the app is a member.
- Reply in that thread. Attach a file and check "Also send to #channel".
- Inspect the payload of the
messageevent the app receives.
In TypeScript, the following code does not compile:
import type { ThreadBroadcastMessageEvent } from "@slack/types";
function handle(event: ThreadBroadcastMessageEvent) {
event.files; // error TS2339: Property 'files' does not exist on type 'ThreadBroadcastMessageEvent'
}
Expected Result
ThreadBroadcastMessageEvent defines files?: File[], upload?: boolean, display_as_bot?: boolean and parent_user_id?: string. Slack sends these fields, so we can access them without a type assertion.
Actual Result
Slack sends a message event with subtype: "thread_broadcast". The event includes files, upload, display_as_bot and parent_user_id:
{
"type": "message",
"subtype": "thread_broadcast",
"user": "U0XXXXXXX",
"text": "broadcast with a file",
"ts": "1791448977.697319",
"thread_ts": "1791447929.601119",
"channel": "C0XXXXXXX",
"channel_type": "channel",
"event_ts": "1791448977.697319",
"client_msg_id": "...",
"parent_user_id": "U0XXXXXXX",
"display_as_bot": false,
"upload": false,
"files": [{ "id": "F0XXXXXXX", "name": "image.png", "filetype": "png", ... }],
"root": { ... },
"blocks": [ ... ]
}
However, ThreadBroadcastMessageEvent does not define any of these four fields:
In the same file, GenericMessageEvent defines files and parent_user_id, and FileShareMessageEvent defines all four.