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 upload flow v2 #292

Merged
merged 15 commits into from
Sep 25, 2024
Merged

Update slack upload flow v2 #292

merged 15 commits into from
Sep 25, 2024

Conversation

Phoenix124
Copy link
Contributor

No description provided.

build.gradle Outdated Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please make sure to rebase the branch

Copy link
Collaborator

Choose a reason for hiding this comment

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

not fixed, please rebase your branch

@Phoenix124
Copy link
Contributor Author

@valfirst review please

@Phoenix124 Phoenix124 requested a review from valfirst August 28, 2024 16:38
try (CloseableHttpClient client = HttpClients.createDefault()) {
postMessage(client, messageData);
} catch (IOException e) {
log.error("Failed to post message to Slack", e);
Copy link
Collaborator

Choose a reason for hiding this comment

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

wrap into MessagingException and re-throw it

slack.getTemplatePath()))
.asString()
.getBody();
@SneakyThrows
Copy link
Collaborator

Choose a reason for hiding this comment

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

why is it needed?

postMessage(client, messageData, filePermalink);

} catch (IOException e) {
log.error("Failed to post message with file to Slack", e);
Copy link
Collaborator

Choose a reason for hiding this comment

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

wrap into MessagingException and re-throw it

}

private String getTextData(MessageData messageData) {
return String.format("channel=%s&text=%s", slack.getChat(), proceedMessageData(messageData));
Copy link
Collaborator

Choose a reason for hiding this comment

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

use UrlEncodedFormEntity instead

}

//todo wait until file processing to complete
Thread.sleep(2000);
Copy link
Collaborator

Choose a reason for hiding this comment

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

is there way to check is file processing completed instead of hardcoded wait?

@Phoenix124 Phoenix124 requested a review from valfirst September 21, 2024 09:11
@Phoenix124
Copy link
Contributor Author

@valfirst fix review.
Btw, it's needed to use slack chat id instead of chat name.

@valfirst
Copy link
Collaborator

@Phoenix124 please rebase the changes against master branch

@Phoenix124
Copy link
Contributor Author

@valfirst updated from master

@Phoenix124 Phoenix124 changed the title add slack upload flow, up java version to java 11 Update slack upload flow v2 Sep 24, 2024
HttpUriRequest request = RequestBuilder
.get("https://slack.com/api/files.getUploadURLExternal")
.addHeader(HttpHeaders.AUTHORIZATION, "Bearer " + slack.getToken())
.addHeader(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON.getMimeType())
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this header really needed for GET request?

@valfirst valfirst linked an issue Sep 25, 2024 that may be closed by this pull request
@valfirst valfirst merged commit 8e47045 into qa-guru:master Sep 25, 2024
5 checks passed
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.

Error when sending reports to slack.
2 participants