Skip to content

Commit db18b88

Browse files
committed
fix(slack): omit initial_comment when blocks present so Block Kit actually renders on file uploads
1 parent 7b6fadc commit db18b88

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

apps/sim/app/api/tools/slack/utils.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,11 @@ async function completeSlackFileUpload(
153153
body: JSON.stringify({
154154
files: uploadedFileIds.map((id) => ({ id })),
155155
channel_id: channel,
156-
initial_comment: text,
156+
// Per Slack docs for files.completeUploadExternal: if `initial_comment`
157+
// is provided, `blocks` is silently ignored. So when blocks are present
158+
// we omit initial_comment and let blocks render instead.
159+
...(blocks && blocks.length > 0 ? { blocks } : { initial_comment: text }),
157160
...(threadTs && { thread_ts: threadTs }),
158-
...(blocks && blocks.length > 0 && { blocks }),
159161
}),
160162
})
161163

0 commit comments

Comments
 (0)