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

Update Slack File Upload API #177

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open

Update Slack File Upload API #177

wants to merge 17 commits into from

Conversation

Yuyuutsu
Copy link
Contributor

@Yuyuutsu Yuyuutsu commented Dec 9, 2024

What is the context of this PR?

This PR is to update the deprecated Slack File Upload method which will be replaced March 2025.
Slack Client has been replaced by Slack's Python SDK. Migration To SDK

Benchmark Pipelines PR: https://github.com/ONSdigital/eq-pipelines/pull/656/files#diff-69a76bccc721b7c5ce6002eded0909122e79faea147db3efd53e1867a3b682a8

How to review

  • Check Tests work locally
  • Fly a benchmark with pointed to this branch and check if the file uploads

@Yuyuutsu Yuyuutsu changed the title updateSlack to use Python SDK and new upload method Update Slack File Upload API Dec 9, 2024
response = client.files_upload(
channels=f"#{slack_channel}",
response = client.files_upload_v2(
channel=slack_channel,
content=content,
filetype=file_type,
Copy link
Contributor

Choose a reason for hiding this comment

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

I got these errors when running it:

UserWarning: The filetype parameter is no longer supported. Please remove it from the arguments.
  warnings.warn("The filetype parameter is no longer supported. Please remove it from the arguments.")
Slack notification errored
Error: channel_not_found

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry for the late reply, my GPG key was expired but it is now updated 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

It's also the channel that is causing the error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated and Working 🤞

Copy link
Contributor

@VirajP1002 VirajP1002 left a comment

Choose a reason for hiding this comment

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

Looks good! Tests passed locally, I also was able to run a benchmark with results being outputted to the correct channel

@Yuyuutsu Yuyuutsu requested a review from a team as a code owner January 6, 2025 09:01
Copy link
Contributor

@petechd petechd left a comment

Choose a reason for hiding this comment

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

Tested it multiple times using own Slack channel, requires pipeline changes going in first.

Copy link
Contributor

@petechd petechd left a comment

Choose a reason for hiding this comment

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

Tested the channel name removal, works as expected!

Copy link
Contributor

@VirajP1002 VirajP1002 left a comment

Choose a reason for hiding this comment

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

Re-ran the tests and all pass, and changes work well, looks good!

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.

3 participants