Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert slack upload file to new api #21

Merged
merged 3 commits into from
Sep 20, 2024

Conversation

kalisp
Copy link
Member

@kalisp kalisp commented Sep 13, 2024

Changelog Description

Existing files_upload was made obsolete and replaced by files_upload_v2.
This PR provides that change.

New method supports better uploads and allows to attach uploaded images without any visible urls in the Slack message as it was before

Additional info

Bumped slack-sdk to 3.19.5 and higher.

Testing notes:

  1. Configure Slack addon similar to files_upload_v2 (use test_integration channel!!)
  2. publish something that will have thumbnail and review
  3. check our Slack test_integration - it should upload and show images without visible urls

Old approach is deprecated.
Modified attacing, now without any visible urls.
files_upload_v2 is available since 3.19.5
@ynbot
Copy link
Contributor

ynbot commented Sep 13, 2024

Task linked: AY-6742 Convert Slack uploadFile to new api

@64qam
Copy link
Member

64qam commented Sep 16, 2024

It returns the wrong formating (in curly brackets)
image

@kalisp
Copy link
Member Author

kalisp commented Sep 16, 2024

It should be {Product[name]} see ynput/ayon-documentation#241
(I created PR with change of documentation as I noticed in there, but forgot to highlight it here too, srry.)

@kalisp kalisp assigned iLLiCiTiT and unassigned MilaKudr Sep 16, 2024
@iLLiCiTiT iLLiCiTiT assigned kalisp and unassigned iLLiCiTiT Sep 16, 2024
with open(published_file, "rb") as f:
uploaded_file = self.client.files_upload_v2(
filename=os.path.basename(published_file),
file=f.read()
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be just?

Suggested change
file=f.read()
file=f

Copy link
Member Author

Choose a reason for hiding this comment

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

It sends the images right now, could try it without .read() though.

Copy link
Member Author

Choose a reason for hiding this comment

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

It works even without read, I removed it and committed.

@kalisp kalisp merged commit 403493e into develop Sep 20, 2024
@iLLiCiTiT iLLiCiTiT added the type: enhancement Improvement of existing functionality or minor addition label Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Improvement of existing functionality or minor addition
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants