Skip to content

Releases: slackapi/java-slack-sdk

version 1.27.0

08 Nov 23:41
Compare
Choose a tag to compare

Changes

  • [slack-api-model] #1076 Add datetimepicker, url, email, number block elements - Thanks @seratch
  • [slack-api-client] #1081 Add requestFileInfo param to MethodsClient#filesUploadV2 method - Thanks @seratch
  • [all] #1077 Upgrade GSON and other optional dependencies - Thanks @seratch
  • [project] #1079 Removed deprecated CodCov script - Thanks @WilliamBergamin
  • [documents] #1073 Resolve minor typos for ExecutorService - Thanks @jasonoh

version 1.26.1

06 Oct 02:32
Compare
Choose a tag to compare

Changes

  • [slack-api-client] #1068 Fix context.teamId for view interactions in a Slack Connect channel - Thanks @seratch

version 1.26.0

05 Oct 03:34
Compare
Choose a tag to compare

Announcements

files.upload v2

We've received many reports on the performance issue of the existing files.upload API. So, to cope with the problem, our platform team decided to unlock a new way to upload files to Slack via public APIs. To utilize the new approach, developers need to implement the following steps on their code side:

  1. Call MethodsClient#filesGetUploadURLExternal() method to receive a URL to use for each file
  2. Perform an HTTP POST request to the URL you received in step 1 for each file
  3. Call MethodsClient#filesCompleteUploadExternal() method with the pairs of file ID and title to complete the whole process, plus share the files in a channel
  4. If you need the full metadata of the files, call MethodsClient#filesInfo() method for each file

We do understand that writing the above code requires many lines of code. Also, the existing MethodsClient#filesUpload() users have to take a certain amount of time for migration. To mitigate the pain, we've added a wrapper method named MethodsClient#filesUploadV2() on the SDK side.

Also, in addition to the performance improvements, another good news is that 3rd party apps can now upload multiple files at a time!

See the following code examples demonstrating how the wrapper method works:

import com.slack.api.Slack;
import com.slack.api.methods.request.files.FilesUploadV2Request;
import com.slack.api.methods.response.files.FilesUploadResponse;
import com.slack.api.methods.response.files.FilesUploadV2Response;

import java.util.Arrays;
import java.util.List;

Slack slack = Slack.getInstance();
String token = System.getenv("SLACK_BOT_TOKEN");

// Legacy files.upload code example
FilesUploadResponse legacyResponse = slack.methods(token).filesUpload(r -> r
  .file(new java.io.File("./logo.png"))
  .filename("logo.png")
  .title("Company Logo")
  .channels(Arrays.asList("C123456"))
  .initialComment("Here is the latest version of our company logo!")
);
com.slack.api.model.File legacyFile = legacyResponse.getFile();

// V2 wrapper is mostly the same!
FilesUploadV2Response v2Response = slack.methods(token).filesUploadV2(r -> r
  .file(new java.io.File("./logo.png"))
  .filename("logo.png")
  .title("Company Logo")
  .channel("C123456") // sharing a file in multiple channels is no longer supported
  .initialComment("Here is the latest version of our company logo!")
);
com.slack.api.model.File v2File = v2Response.getFile();

// Now you can upload multiple files at a time!
FilesUploadV2Response v2MultiFilesResponse = slack.methods(token).filesUploadV2(r -> r
  .fileUploads(Arrays.asList(
    FilesUploadV2Request.FileUpload.builder()
      .file(new java.io.File("./logo.png"))
      .filename("logo.png")
      .title("Company Logo")
      .build(),
    FilesUploadV2Request.FileUpload.builder()
      .file(new java.io.File("./2022-03-01-meeting-minutes.md"))
      .filename("2022-03-01-meeting-minutes.md")
      .title("2022-03-01 Meeting Minutes")
      .snippetType("text")
      .build()
  ))
  .channel("C123456")
  .initialComment("Here are the files I mentioned in the meeting :wave:")
);
List<com.slack.api.model.File> v2Files = v2MultiFilesResponse.getFiles();

When migrating to the v2 method, please note that the new method requires both files:write and files:read scopes. If your existing apps have only files:write scope for uploading files, you need to add files:read to the scopes plus re-install the app to issue an updated token. UPDATE: When you use v1.34.0 or newer, the method returns full file metadata without files:read scope.

Slack#close() method now terminates underlying thread pools.

Since this version, Slack instances are compatible with AutoCloseable interface. The Slack#close() method safely terminates its underlying thread pools managed by SlackConfig instance. This can be beneficial especially for resource intensive apps.

Changes

  • [slack-api-model] #1047 Add share_shortcut block support (for the new beta platform) - Thanks @seratch
  • [slack-api-client] #1065 Add files.upload v2 support - Thanks @seratch
  • [slack-api-client] #1063 Fix #1061 Add message metadata support for response_url / Incoming Webhooks calls - Thanks @baole
  • [slack-api-client] #1064 Fix #1060 Enable Slack#close() method to shutdown thread pools behind its SlackConfig - Thanks @seratch @CarlosMOGoncalves
  • [slack-api-client] #1059 Fix #1058 Add include_all_metadata to conversations.replies arguments - Thanks @scarytom
  • [bolt] #1051 Fix NPE when initializing App's status in 3-args constructor - Thanks @musketyr
  • [bolt-micronaut] #1049 Fix #1048 bolt-micronaut does not support the OAuth flow - Thanks @musketyr
  • [bolt-micronaut] #1053 Fix #1052 CommandsTest for Bolt Micronaut does not work - Thanks @musketyr

version 1.25.1

05 Sep 04:08
Compare
Choose a tag to compare

Changes

  • [slack-api-client] #1043 Add headers to WebhookResponse class - Thanks @seratch

version 1.25.0

30 Aug 05:19
Compare
Choose a tag to compare

Changes

Document Changes

  • #1024 Fix typos in javadoc, comments and documentations Updates - Thanks @marcwrobel
  • #1037 #1036 The filetype API method doc has an unformated/invalid link to file types - Thanks @filmaj

version 1.24.0

14 Jul 22:37
Compare
Choose a tag to compare

Announcements

Embedding videos in Block Kit

Block Kit now supports embedding a video in any surface areas. Check the document and example code:

bolt-ktor is now compatible with Ktor 2 or newer

Since this version, bolt-ktor module supports only Ktor 2.x. Refer to Ktor team's announcement and migration guide for more details:

Changes

Document Changes

  • Updates tyrus-standalone-client version from 1.17 to 1.19 in the documentations - Thanks @marcwrobel

version 1.23.1

08 Jul 05:12
Compare
Choose a tag to compare

Changes

  • [slack-api-model] #1010 Add timezone property to timepicker block element - Thanks @seratch

version 1.23.0

22 Jun 22:10
Compare
Choose a tag to compare

Important Notice

Use say method with both text and blocks

Since this version, Bolt's say() utility accepts both text and blocks at a time. When you pass blocks to the method, it'd be recommended to add text string too. At a glance, the text value may look duplicated, but having it would be valuable for better user experience such as meaningful mobile notification message and accessibility support.

HTTP_PROXY / HTTPS_PROXY env variables are now used

Since this version, the default initialization of SlackConfig tries to load HTTP_PROXY / HTTPS_PROXY env variables, which are common practices to set the proxy server URL to use, if they exist. If you want to use a different proxy URL, you can set the URL using the setter methods.

OkHttp version 4.10

Since this version, this SDK uses OkHtttp 4.10 for HTTP requests. Although the version does not bring any big changes, its underlying Okio library has a major version upgrade. Refer to their release notes for details. If you find something unexpected since this version, please let us know in our GitHub issues.

Changes

  • [bolt] #1002 Add an overloaded method that accepts both text and blocks to Say - Thanks @seratch
  • [slack-api-client] #1003 Fix #992 Automatically resolve the proxy URL by HTTP_PROXY env variable - Thanks @seratch @amarinelli
  • [slack-api-client] #1001 Fix #998 Upgrade okhttp version to 4.10 - Thanks @seratch
  • [slack-api-cljent] #1000 Add unfurling capabilities to Webhook payload - Thanks @jazcarate
  • [slack-api-client] #1004 Fix a bug where constructing blocks / attachments etc. using anonymous inner class initialization - Thanks @WilliamBergamin
  • [slack-api-client] #1005 Fix a bug where the workflow step request builder has wrong null validation logic - Thanks @WilliamBergamin

version 1.22.3

17 Jun 01:14
Compare
Choose a tag to compare

Changes

  • [slack-api-client] #997 Add cursor parameter to reactions.list API method - Thanks @seratch
  • [slack-api-client] #999 Fix a bug where DetailedLoggingListener does not print text request body - Thanks @seratch

@WilliamBergamin reported both of the above issues. Thanks a lot!


version 1.22.2

09 Jun 06:01
Compare
Choose a tag to compare

Changes

  • [slack-api-model] #994 Add missing properties to ChannelDeletedEvent - Thanks @seratch
  • Upgrade Kotlin version to 1.7 - Thanks @seratch

Document Updates

  • #988 #989 Link getting started instructions for gradle to the gradle app quickstart - Thanks @filmaj
  • #988 #990 Small improvements to the getting started documents for Bolt - Thanks @filmaj
  • #991 Update Japanese documents to have #990 changes - Thanks @seratch