Skip to content

Releases: slackapi/java-slack-sdk

version 1.42.0

23 Aug 01:24
Compare
Choose a tag to compare

Announcements

Jakarta EE compatible Socket Mode

Since this version, developers can migrate to the newer Jakarta EE compatible WebSocket interface for Socket Mode modules. To enable this, the following two optional modules are added:

  • com.slack.api:slack-jakarta-socket-mode-client
  • com.slack.api:bolt-jakarata-socket-mode

The Socket Mode client's default implementation uses tyrus-standalone-client 1.x, which is compatible with javax.websocket-api APIs. The Jakarta EE version of this interface is the jakarta.websocket-client-api APIs, and tyrus-standalone-client 2.x is compatible with it. Since it's not feasible to have both tyrus-standalone-client 1.x and 2.x in the same module's dependencies, I have added a new module named slack-jakarta-socket-mode-client. See #919 for more details.

Developers can initialize the Jakarta-compatible SocketModeClient this way:

import com.slack.api.Slack;
import com.slack.api.jakarta_socket_mode.JakartaSocketModeClientFactory;

public class Example {
  public static void main(String[] args) throws Exception {
    var appToken = System.getenv("SLACK_APP_TOKEN");
    var slack = Slack.getInstance();
    // Java EE compatible Socket Mode client
    slack.socketMode(appToken).connect();
    // Jakarta EE compatible Socket Mode client
    JakartaSocketModeClientFactory.create(slack, appToken).connect();
  }
}

In the same way, I’ve added a new Jakarta-compatible module, which is equivalent to bolt-socket-mode. Here is the demo code. As you can see, just replace the dependency and imports in the code:

import com.slack.api.bolt.App;
import com.slack.api.bolt.jakarta_socket_mode.SocketModeApp;

public class Example {
  public static void main(String[] args) throws Exception {
    var app = new App();
    app.command("/hi", (req, ctx) -> {
      ctx.say("Hi there!");
      return ctx.ack();
    });
    var appToken = System.getenv("SLACK_APP_TOKEN");
    // Switch from com.slack.api.bolt.socket_mode to com.slack.api.bolt.jakarta_socket_mode
    new SocketModeApp(appToken, app).start();
  }
}

The reason behind this enhancement is that many Java-house companies are planning to eliminate the legacy javax.* dependencies from their project settings. I don't think the short-term risk of having a javax.websocket dependency is significant, but it seems it's about time to provide an option for migration on the developers' side.

Changes

  • [slack-api-client][bot] #1352 Add Jakarta EE compatible Socket Mode client ref: #919 - Thanks @seratch
  • [slack-api-client] Add missing properties in web API responses - Thanks @seratch

version 1.41.0

20 Aug 07:58
Compare
Choose a tag to compare

Announcements

Support for custom steps

Bolt for Java now supoports the way to build custom steps in Workflow Builder. Here is a quick example demonstrating how it works:

app.function("sample_function", (req, ctx) -> {
  app.executorService().submit(() -> {
    try {
      var userId = req.getEvent().getInputs().get("user_id").asString();
      var response = ctx.client().chatPostMessage(r -> r
        .channel(userId) // sending a DM
        .text("Hi! Thank you for submitting the request! We'll let you know once the processing completes.")
      );
      var outputs = new HashMap<String, Object>();
      outputs.put("channel_id", response.getChannel());
      outputs.put("ts", response.getTs());
      ctx.complete(outputs);
    } catch (Exception e) {
      ctx.logger.error(e.getMessage(), e);
      try {
        ctx.fail("Failed to handle 'sample_function' custom step execution (error: " + e.getMessage() + ")");
      } catch (Exception ex) {
        ctx.logger.error(e.getMessage(), e);
      }
    }
  });
  return ctx.ack();
});

The App Manifest for the custom step would be something like this:

"functions": {
    "sample_function": {
        "title": "Send a request",
        "description": "Send some request to the backend",
        "input_parameters": {
            "user_id": {
                "type": "slack#/types/user_id",
                "title": "User",
                "description": "Who to send it",
                "is_required": true,
                "hint": "Select a user in the workspace",
                "name": "user_id"
            }
        },
        "output_parameters": {
            "channel_id": {
                "type": "slack#/types/channel_id",
                "title": "DM ID",
                "description": "The DM ID",
                "is_required": true,
                "name": "channel_id"
            },
            "ts": {
                "type": "string",
                "title": "Message timestamp",
                "description": "Sent message timestamp",
                "is_required": true,
                "name": "ts"
            }
        }
    }
}

Please refer to https://api.slack.com/automation/functions/custom-bolt for more details!

Changes

  • [bolt] #1241 Add custom function support - Thanks @seratch
  • [bolt][slack-app-backend] #1351 #1343 block_suggestion response does not support description in an option - Thanks @ESteanes @seratch
  • [slack-api-client] #1346 Fix a bug where filename & title getting improperly defaulted in filesUploadV2 - Thanks @Cheos137
  • [slack-api-client] Add missing properties in web API responses - Thanks @seratch

version 1.40.3

16 Jul 23:35
Compare
Choose a tag to compare

Changes

  • [slack-api-client] #1337 Fix #1336 missing and invalid properties in rich text block elements - Thanks @seratch @Falit
  • [slack-api-client] Add new properties to Web API responses - Thanks @seratch
  • [bolt] Add missing properties in app_mention event payload - Thanks @seratch

version 1.40.2

03 Jul 01:53
Compare
Choose a tag to compare

Changes

  • [slack-api-client] #1330 Add conversations.externalInvitePermissions.set API support - Thanks @seratch
  • [slack-api-client] #1331 Add team.externalTeams.disconnect API - Thanks @seratch
  • [bolt] #1332 Add a few missing event data types - Thanks @seratch
  • [slack-api-client] Add new properties to Web API responses - Thanks @seratch

version 1.40.1

19 Jun 03:12
Compare
Choose a tag to compare

Changes

  • [slack-api-client] #1327 Add team.externalTeams.list API support - Thanks @seratch
  • [slack-api-client] Add new properties to Web API responses - Thanks @seratch

version 1.40.0

13 Jun 06:11
Compare
Choose a tag to compare

Changes

  • [slack-api-client] #1323 Add canvas APIs and users.discoverableContacts.lookup API - Thanks @filmaj @seratch
  • [all] #1319 Add deprecation warnings to Steps from Apps components - Thanks @seratch
  • [slack-api-client] Add new properties to Web API responses - Thanks @seratch
  • [documents] Mark "Steps from Apps" as deprecated - Thanks @seratch

version 1.39.3

27 May 05:57
Compare
Choose a tag to compare

Changes

  • [slack-api-client] #1316 Fix #1314 files.upload v2 method does not upload multiple files with full metadata - Thanks @oppokui @seratch

version 1.39.2

14 May 07:06
Compare
Choose a tag to compare

Changes

  • [slack-api-client] #1312 Fix #1311 entity.message is missing in Audit Logs API response - Thanks @seratch

version 1.39.1

10 May 02:49
Compare
Choose a tag to compare

Changes

  • [slack-api-client] #1298 Mark files.upload / rtm.connect as deprecated - Thanks @seratch
  • [slack-api-client] #1310 Fix #1308 repsonse_metadata is missing in admin.initeRequests.list/*.list response classes - Thanks @Dunkhell @seratch
  • [slack-api-client] Add new properties to Web API responses - Thanks @seratch

Test improvements:


version 1.39.0

29 Mar 02:40
Compare
Choose a tag to compare

Changes

  • [slack-api-client] Add support for micronaut 4 - Thanks @hrothwell
  • [slack-api-client] Many property addition to Web API response types - Thanks @seratch