Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

ThreadBroadcastMessageEvent is missing `bot_id`

Aperta Adatta ai principianti
#2,766 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
node.js, typescript
Ambito
api

Direzione di ricerca

La issue rimanda a packages/types/src/events/message.ts, in particolare alla definizione di ThreadBroadcastMessageEvent intorno alle righe 276–300. Leggi quel tipo insieme a GenericMessageEvent e verifica se ci sono test di tipo correlati. Il lavoro è terminato quando bot_id?: string è rappresentato nell’evento di broadcast e i tipi accettano l’accesso a event.bot_id.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

untriaged
Package

@slack/types

SDK Version

@slack/[email protected]

Node.js Version

N/A (type definition issue)

Operating System

No response

Steps to Reproduce
  1. Set up an app subscribed to the message.channels event.
  2. Start a thread as a user in a channel where the app is a member.
  3. As the bot, reply in that thread with chat.postMessage({ channel, thread_ts, text, reply_broadcast: true }).
  4. Inspect the payload of the message event the app receives for that reply.

In TypeScript, the following code does not compile:

import type { ThreadBroadcastMessageEvent } from "@slack/types";

function isFromBot(event: ThreadBroadcastMessageEvent) {
  return !!event.bot_id; // error TS2339: Property 'bot_id' does not exist on type 'ThreadBroadcastMessageEvent'
}
Expected Result

ThreadBroadcastMessageEvent defines bot_id?: string, like GenericMessageEvent does. Slack sends this field, so we can check whether the broadcast reply itself was posted by a bot without a type assertion.

Actual Result

Slack sends a message event with subtype: "thread_broadcast". The event includes a top-level bot_id:

{
  "type": "message",
  "subtype": "thread_broadcast",
  "user": "U0XXXXXXX",
  "bot_id": "B0XXXXXXX",
  "app_id": "A0XXXXXXX",
  "text": "broadcast test",
  "ts": "1791786680.944589",
  "thread_ts": "1791786656.190749",
  "channel": "C0XXXXXXX",
  "channel_type": "channel",
  "event_ts": "1791786680.944589",
  "root": { "user": "U0YYYYYYY", "ts": "1791786656.190749", "reply_count": 2, ... },
  "blocks": [ ... ]
}

However, ThreadBroadcastMessageEvent does not define bot_id, even after #2763:

https://github.com/slackapi/node-slack-sdk/blob/e02e7feeb500bfde1f947401a639633e42ce2f91/packages/types/src/events/message.ts#L276-L300

The only bot_id reachable from this type is root.bot_id, which describes the thread parent, not the broadcast reply. Code that uses root.bot_id to detect bot messages gets both cases wrong: a user's broadcast in a bot-started thread looks like a bot message, and a bot's broadcast in a user-started thread looks like a user message.

This is a follow-up to #2762, which covered other missing fields on the same type.

Lingua principale
TypeScript
Stelle
3.4k
Fork
687
Merge medio
1g 2h
PR unite (30g)
14

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di slackapi/node-slack-sdk

Tutte le issue di slackapi/node-slack-sdk

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.