Skip to content

Releases: slackapi/java-slack-sdk

version 1.20.1

03 Mar 04:21
Compare
Choose a tag to compare

Changes

  • [slack-api-client] #943 Add missing parameters in chat.update API method - Thanks @seratch
  • [slack-api-client] #946 Fix #945 Log level for rate-limited error logging - Thanks @seratch @jahlbornG
  • [slack-api-client] Audit Logs API response updates - Thanks @seratch

version 1.20.0

19 Feb 01:09
Compare
Choose a tag to compare

Changes

  • [bolt-socket-mode] #939 #937 bolt-socket-mode establishes a connection before a SocketModeApp#start()/startAsync() method call - Thanks @seratch
  • [slack-api-client] #938 #931 AdminAppsRequestsListRequest class missing enterpriseId field - Thanks @seratch @andrewtcobb

version 1.19.0

17 Feb 11:50
Compare
Choose a tag to compare

New Features

A new option to completely disable the underlying API call metrics management

The smart rate limiter feature in this SDK is so useful for easily managing rate limits in Slack API calls.
https://slack.dev/java-slack-sdk/guides/web-api-basics#rate-limits

However, as reported at #933, the feature can be a bit overhead for the app that needs to handle requests associated with a large number of workspace installations (say, thousands!).

Since this version, we've added a new option statsEnabled to SlackConfig and its API client level sub configs such as MethodsConfig, SCIMConfig, and AuditConfig. The default value is true, which is compatible with the past versions.

If you don't need the traffic metrics at all, you can disable this feature by the following way:

SlackConfig config = new SlackConfig();
config.setStatsEnabled(false);
Slack slack = Slack.getInstance(config);

For more granular control, you can set the same flag for each API client:

SlackConfig config = new SlackConfig();
// Disable the metrics only for Web API methods
config.getMethodsConfig().setStatsEnabled(false);
// For SCIM, Audit Logs APIs, the metrics are still available
Slack slack = Slack.getInstance(config);

If you set this flag to false, you can get rid of the potential overhead for large-scale apps. The downside of the customization would be that your app needs to manage rate-limited error patterns on our own. This is because disabling the option means that API call history data, which this SDK's smart rate limiter feature relies on, is no longer maintained.

Also, since this release, the API client behavior with the default settings is significantly improved. Therefore, for most apps, now the default configuration should work without any performance issues.

Changes

  • [slack-api-client] #931 Add bookmarks.* Web APIs - Thanks @seratch
  • [slack-api-cljent] #930 Add admin.users.unsupportedVersions.export API support - Thanks @seratch
  • [slack-api-client] #925 Add accessibility_label to button block element - Thanks @seratch
  • [slack-api-client] #934 Fix #933 by adjusting the internals of smart rate limiter - Thanks @sidneyamani @seratch
  • [all] #932 Upgrade gson, slf4j versions and others - Thanks @seratch

version 1.18.0

27 Jan 23:32
Compare
Choose a tag to compare

New Features

Jakarta EE Servlet Compatible Bolt Adapters

In this release, we've added new Bolt adapters for Jakarta EE users:

  • com.slack.api:bolt-jakarta-servlet(javadocs), which is compatible with jakarta.servlet 5.0
  • com.slack.api:bolt-jakarta-jetty (javadocs), which is compatible with jakarta.servlet 5.0 + jetty 11.x

There is no breaking change to the existing Java EE based modules. Also, we know that many developers in the Java community are still using javax.servlet for their production apps. We will continue to support both Java EE and Jakarta EE for a long enough time.

As for the transition of the rest of Jakarta EE dependencies (specifically, we have javax.websocket dependency in provided scope), refer to the discussion at #919 (comment).

Deprecations

The classes under com.slack.api.app_backend.events.servlet in com.slack.api:slack-app-backend are deprecated since this version. We generally recommend using Bolt for Java for new app development. To learn do the same with Bolt, please read the document page. If you have to continue using the deprecated classes for a certain reason, please feel free to copy them into your application under the MIT open-source license.

Changes

  • [slack-api-client] #921 Improve #917 not to rely on #toString() method behavior - Thanks @seratch
  • [bolt] #920 Add bolt-jakarta-servlet and bolt-jakarta-jetty modules for Jakarta EE supports - Thanks @seratch @kuzuha
  • [all] #922 Upgrade optional dependencies and organize pom.xml - Thanks @seratch

version 1.17.1

26 Jan 00:50
Compare
Choose a tag to compare

Changes

  • [slack-api-client] #917 Improve the thread pool management under the hood - Thanks @seratch
  • [bolt] #918 Fix context.getTeamId() to return a valid ID for org-wide installations - Thanks @seratch
  • [all] Upgrade slf4j-api patch version and other optionals ones - Thanks @seratch

version 1.17.0

21 Jan 01:39
Compare
Choose a tag to compare

New Features

Customize ExecutorService used inside the SDK

f you desire to pass your own ExecutorService to this SDK, now ExecutorServiceProvider interface is available for you.

You can implement the interface with your own factory methods and pass its instance to either SlackConfig (for API clients) or AppConfig (for Bolt apps).

var config = new SlackConfig();
config.setExecutorServiceProvider(new MyExecutorServiceProvider())
var slack = Slack.getInstance(config);

// ExecutorService will be provided by MyExecutorServiceProvider
var future = slack.methodsAsync().authTest(r -> r.token(System.getenv("SLACK_BOT_TOKEN"));

If you pass it to AppConfig, all the underlying API clients use the same ExecutorServiceProvider.

var config = AppConfig.builder()
  .signingSecret(System.getenv("SLACK_SIGNING_SECRET"))
  .singleTeamBotToken(System.getenv("SLACK_BOT_TOKEN"))
  .executorServiceProvider(new MyExecutorServiceProvider())
  .build();
var app = new App(config);
var server = new SlackAppServer(app);
server.start();

Refer to #915 and #916 for more details.

Changes

  • [all] #916 Fix #915 by adding ExecutorServiceProvider to enable developers to use their own ExecutorService - Thanks @seratch @jahlbornG
  • [all] Upgrade minor/patch versions of the optional dependencies. - Thanks @seratch

version 1.16.1

17 Jan 06:07
Compare
Choose a tag to compare

Changes

  • [slack-api-client] #911 Add admin.apps.requests.cancel API - Thanks @seratch
  • [bolt] #914 Fix #913 user-scope only OAuth does not work since v1.10 - Thanks @seratch @loc02998375
  • [all] #912 Upgrade slf4j-api patch version and other optionals ones - Thanks @seratch

version 1.16.0

17 Dec 03:19
Compare
Choose a tag to compare

Changes

  • [slack-api-client] Add newly added properties in Events API payloads / Web API responses - Thanks @seratch
  • [bolt-micronaut] #903 Fix #891 Migrate Micronaut version to 3.2 - Thanks @seratch @volgin
  • [all] #905 Upgrade optional module dependencies' minor/patch versions - Thanks @seratch
  • [all] #898 Add GitHub stale action for better triaging issues - Thanks @srajiang @seratch
  • [docs] #902 Replace instances of "event" with "request" in docs - Thanks @wongjas

version 1.15.0

30 Nov 08:43
Compare
Choose a tag to compare

Changes

  • [slack-api-model] #893 Add focus_on_load support in Block Kit element classes - Thanks @seratch
  • [slack-api-client] #895 #896 Calling chat.unfurl with user_auth_blocks resulting in error invalid_arguments - Thanks @erathorus @seratch
  • [all] #897 Bump dependency versions for v1.15 release - Thanks @seratch

version 1.14.0

13 Nov 02:08
Compare
Choose a tag to compare

New Features

OAuth flow persistence callbacks

In the past, if a developer desires to customize the parts equivalent to callback_options in bolt-js/bolt-python in the OAuth flow, the developer has to implement the whole OAuthV2SuccessHandler with mostly the same code with DefaultOAuthV2SuccessHandler.

app.oauthCallback(new OAuthV2SuccessHandler() {
  @Override
  public Response handle(OAuthCallbackRequest request, Response response, OAuthV2AccessResponse apiResponse) {
    // Implement your own logic here
    return null;
  }
});

Since v1.14, bolt-java provides App#oauthPersistenceCallback and App#oauthPersistenceErrorCallback methods to accept more granular callbacks. These callbacks can be used for customizing the way your app behaves right after saving (or failing to save) issued tokens and their metadata in your database.

var oauthApp = new App(config);

// To customize the behavior after the installation persistence:
// The default behavior is to display the default completion web page
// or to redirect the installer to the pre-given completion URL.
oauthApp.oauthPersistenceCallback(arguments -> {
  var response = arguments.getResponse();
  response.setStatusCode(200);
  response.setContentType("text/plain; charset=utf-8");
  response.setBody("OK!");
});

// To customize the behavior when the installation persistence fails:
// The default behavior is to display the default error web page
// or to redirect the installer to the pre-given failure URL.
oauthApp.oauthPersistenceErrorCallback(arguments -> {
  var response = arguments.getResponse();
  response.setStatusCode(500);
  response.setContentType("text/plain; charset=utf-8");
  response.setBody("Something wrong! (" + arguments.getError().getMessage() + ")");
});

apps.put("/slack/oauth/", oauthApp.asOAuthApp(true));
var server = new SlackAppServer(apps);
server.start();

Apart from the two we added in this version, the following callbacks have been also available for customizing some parts of your app's OAuth flow:

// in the case where the "error" parameter is passed from the Slack OAuth flow
oauthApp.oauthCallbackError((request, response) -> {
  response.setStatusCode(401);
  response.setContentType("text/plain; charset=utf-8");
  response.setBody("Something wrong! (" + request.getPayload().getError() + ")");
  return response;
});

// in the case where the "state" parameter is invalid
oauthApp.oauthCallbackStateError((request, response) -> {
  response.setStatusCode(401);
  response.setContentType("text/plain; charset=utf-8");
  response.setBody("Something wrong! (state is invalid)");
  return response;
});

// in the case where an error code is returned from the oauth.v2.access API
oauthApp.oauthCallbackAccessError((OAuthV2AccessErrorHandler) (request, response, apiResponse) -> {
  response.setStatusCode(401);
  response.setContentType("text/plain; charset=utf-8");
  response.setBody("Something wrong! (" + apiResponse.getError() + ")");
  return response;
});

With that, bolt-java's OAuth flow module now provides even greater flexibility for developers. If you still see missing pieces in the module, please let us know in the GitHub issue tracker 🙇

Slack guest configuration in SCIM APIs

The SCIM API client now supports "urn:scim:schemas:extension:slack:guest:1.0" schema. In your Java code, you can attach the Slack guest specific attributes in a simple way:

var newGuestUser = new User();
newGuestUser.setName(new User.Name());
newGuestUser.getName().setGivenName("Kazuhiro");
newGuestUser.getName().setFamilyName("Sera");
newGuestUser.setUserName("seratch");
var email = new User.Email();
email.setValue("[email protected]");
newGuestUser.setEmails(Arrays.asList(email));

// ISO 8601 date time string
var df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");
var expiration = df.format(Date.from(ZonedDateTime.now().plusDays(14).toInstant()));
var slackGuest = User.SlackGuest.builder().type(User.SlackGuest.Types.MULTI).expiration(expiration).build();
newGuestUser.setSlackGuest(slackGuest);

var response = slack.scim(orgAdminToken).createUser(req -> req.user(newGuestUser));

To learn more about the schema itself, please refer to the SCIM API document: https://api.slack.com/scim#post-multi-channel-guest

Changes

  • [bolt] #875 #883 Add callback_options equivalent to Bolt for Java - Thanks @seratch
  • [slack-api-client] #886 #862 Add "urn:scim:schemas:extension:slack:guest:1.0" schema support in the SCIM API client - Thanks @seratch
  • [slack-api-client] #887 #888 auth.revoke API call with a "Sign in with Slack" causes an "invalid_auth" error - Thanks @erathorus @seratch
  • [slack-api-client] #882 Add admin.users.session.resetBulk API support - Thanks @seratch
  • [docs] #881 Document fix: Code snippet error in the OAuth document section - Thanks @jaebradley