Skip to content

slack: use fileuploadv2 for uploading#129

Merged
poVoq merged 2 commits into
matterbridge-org:masterfrom
asdfzdfj:master
Jan 16, 2026
Merged

slack: use fileuploadv2 for uploading#129
poVoq merged 2 commits into
matterbridge-org:masterfrom
asdfzdfj:master

Conversation

@asdfzdfj

Copy link
Copy Markdown

simple patch to replace deprecated and now disabled UploadFile with UploadFileV2, which already automates the new file upload steps as described in the slack docs

only did a few scuffed tests with telegram <-> slack but it seems to be working

should fix #33

@asdfzdfj asdfzdfj force-pushed the master branch 2 times, most recently from c4fe760 to 08b08ce Compare January 16, 2026 09:26
@poVoq

poVoq commented Jan 16, 2026

Copy link
Copy Markdown
Collaborator

Looks good and thanks a lot for this contribution!

Could you still add a changelog entry please?

In general we do not have a maintainer of the Slack part of the bridge right now. Would you be willing to help out with that?

@poVoq poVoq merged commit e6f466a into matterbridge-org:master Jan 16, 2026
7 checks passed
@asdfzdfj

Copy link
Copy Markdown
Author

Could you still add a changelog entry please?

changelog added as requested

In general we do not have a maintainer of the Slack part of the bridge right now. Would you be willing to help out with that?

unfortunately I don't know much Go, and only sorta showed up here due to workplace related issues, so I don't think I'll be able to dedicate effort for maintaining the slack bridge here

that said, I might help out a bit with the slack bridge in the future, at least to keep it working in my workplace if nothing else (and from the looks of it, it seems to rely on the increasingly deprecated and discontinued slack api functions for its work, some upgrades is certainly needed)

@poVoq

poVoq commented Jan 16, 2026

Copy link
Copy Markdown
Collaborator

Welcome to the club. It seems like all the people currently involved are not much experienced with Golang.

But ok, if we run into Slack specific issues we will mention you and maybe you can at least help us test it as I think no one else is a Slack user. Thanks!

Comment thread bridge/slack/slack.go
}
if res.ID != "" {
// UploadFileV2 doesn't return the full slack.File info like the previous UploadFile, so query it separately
sfi, _, _, err := b.sc.GetFileInfo(res.ID, 0, 1)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be done in the background, otherwise it may block the main thread.

Comment thread bridge/slack/slack.go
initialComment += fmt.Sprintf(" with comment: %s", fi.Comment)
}
res, err := b.sc.UploadFile(slack.FileUploadParameters{
res, err := b.sc.UploadFileV2(slack.UploadFileV2Parameters{

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be done in the background, otherwise it may block the main thread.

@selfhoster1312

Copy link
Copy Markdown
Collaborator

Looks good if it's working as intended! "minor" nitpick: network queries should be performed in their own goroutine so they don't block the main thread.

From what i can read, it looks like all file attachments are uploaded in a single message. But the returned messageID is overwritten on every loop iteration. Is it supposed to be the same ID for all attachments? If yes, we could simply run the whole uploadFile method in the background:

go b.uploadFile(&msg, channelInfo.ID)
return "", nil

I'm not sure what the consequence of not providing the generated ID back to the gateway would be. Maybe that impacts message replies/edits? This is still an area of code/architecture we haven't fully investigated and documented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Files are no longer sent in Slack

3 participants