Slack: post text and image files as one message instead of a file message followed by a text message
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 30/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
- Ambito
- backend
Direzione di ricerca
Start in the Slack adapter's postMessage and its uploadFiles helper, which currently call files.completeUploadExternal with a channel and thread, then chat.postMessage for the text. The change moves image files into one chat.postMessage call with blocks (a markdown block plus image blocks using slack_file), with a bounded retry on invalid_blocks. Done means one thread message per post, correct ordering, and the long-text fallback still working; the issue leaves the non-image file case and opt-in behaviour open, so settle those with maintainers first.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem Statement
On Slack, thread.post({ markdown, files }) produces two messages. The adapter's postMessage first calls uploadFiles, which runs files.completeUploadExternal with channel_id and thread_ts, so Slack posts the files as their own thread message; it then posts the text with chat.postMessage. In a thread the reader sees two bubbles per post, the text below the images it belongs to.
Slack also posts the file message asynchronously: completeUploadExternal returns before the file message is visible. When an app posts two messages in a row, each with text and images, the thread can end up ordered text, text, image, image.
Proposed Solution
When a Slack post carries image files, upload them privately and reference them from the text message's blocks, so one chat.postMessage carries both:
files.completeUploadExternalwith nochannel_id. The files stay private to the bot and Slack posts nothing for them.chat.postMessagewithblocks: amarkdownblock holding the text, followed by oneimageblock per file usingslack_file: { id }.
The post is synchronous, so thread order follows call order, and the markdown rendering of the text is kept. SentMessage.id becomes the real ts of the one message, so callers no longer get the synthetic file-{timestamp} id for a files-only post.
One Slack behaviour the adapter would need to absorb: for a short window after completeUploadExternal returns (about 500 ms in our runs), chat.postMessage rejects the reference with invalid_blocks and an error entry naming slack_file. A short bounded retry on that specific error addresses this.
The markdown block has the same 12,000-character cap as markdown_text, cumulative across the markdown blocks of one payload, so the existing fallback for long text still applies. Non-image files cannot go in an image block, so a post that carries them would keep the current path, or the behaviour could be opt-in through a post option.
Alternatives Considered
Calling the Slack Web API directly from our app: this is what we do today for this one path, which means bypassing the adapter's postMessage and reimplementing its token handling for one message type.
Use Case
import { Chat } from "chat";
// Today this is two Slack messages (files, then text); the request is
// for one message with the text above the images.
await bot.thread(threadId).post({
markdown: noteText,
files: [
{ data: screenshotA, filename: "before.png", mimeType: "image/png" },
{ data: screenshotB, filename: "after.png", mimeType: "image/png" },
],
});
Priority
Nice to have
Contribution
- I am willing to help implement this feature
Additional Context
No response
- Lingua principale
- TypeScript
- Stelle
- 2.5k
- Fork
- 355
- Merge medio
- 2g 15h
- PR unite (30g)
- 42
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di vercel/chat
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
X and Twitch: paragraphs inside a block quote are joined with no spaceForse già presa @abhiramshaji-cyber l’ha presa 5 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
solidjs/solid-docs#1716 ·
I maintainer di solito rispondono entro 1 giorno
-
bug needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Progress indicated by console logs is off by oneForse già presa @marceliwac l’ha presa oggi. Apertabug needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
aws-samples/aws-cdk-examples#1336 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
melgarafael/DeskcommCRM#4999 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 2 giorni