Releases: slackapi/java-slack-sdk
version 1.4.0
New Features
Org-Wide App Installation support
This version includes the changes related to Org-Wide App feature, which is for Enterprise Grid organizations.
- Add new events -
team_access_granted
/team_access_removed
- Change the default behavior of the OAuth flow to render web pages (you can switch back to the v1.3 behavior by
OAuthInstallPageRenderingEnabled(false)
) - Org-wide app related fields in payloads (enterprise, is_enterprise_install)
Changes
- [all] #617 #621 #638 Org Apps support - Thanks @seratch
- [all] #636 Bump dependency versions for v1.4.0 release - Thanks @seratch
- [bolt] #624 #623 Move com.slack.api.bolt.response.Responder to com.slack.api.bolt.util - Thanks @seratch
- All issues/pull requests: https://github.com/slackapi/java-slack-sdk/milestone/16?closed=1
- All changes: v1.3.3...v1.4.0
version 1.4.0 RC1
New Features
Org-Wide App Installation support
This version supports new features for Org-Wide App feature.
- Add new events -
team_access_granted
/team_access_removed
- Change the default behavior of the OAuth flow to render web pages (you can switch back to the v1.3 behavior by
OAuthInstallPageRenderingEnabled(false)
) - Org-wide app related fields in payloads (enterprise, is_enterprise_install)
Changes
- [all] #617 #621 #638 Org Apps support - Thanks @seratch
- [all] #636 Bump dependency versions for v1.4.0 release - Thanks @seratch
- [bolt] #624 #623 Move com.slack.api.bolt.response.Responder to com.slack.api.bolt.util - Thanks @seratch
- All issues/pull requests: https://github.com/slackapi/java-slack-sdk/milestone/16?closed=1
- All changes: v1.3.3...v1.4.0-RC1
version 1.3.3
Changes
- [app-backend] #637 #635 Add top-level state to block_actions payload - Thanks @lfbrandao @seratch
- All issues/pull requests: https://github.com/slackapi/java-slack-sdk/milestone/21?closed=1
- All changes: v1.3.2...v1.3.3
version 1.3.2
Changes
- All issues/pull requests: https://github.com/slackapi/java-slack-sdk/milestone/20?closed=1
- All changes: v1.3.1...v1.3.2
version 1.3.1
Changes
- All issues/pull requests: https://github.com/slackapi/java-slack-sdk/milestone/19?closed=1
- All changes: v1.3.0...v1.3.1
version 1.3.0
New Features
Ktor / http4k extentions for Bolt
Two major Kotlin web frameworks, Ktor and http4k, are officially supported.
Ktor
build.gradle
plugins {
id("org.jetbrains.kotlin.jvm") version "1.4.10"
id("application")
}
repositories {
mavenCentral()
}
dependencies {
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("com.slack.api:bolt-ktor:1.3.0")
implementation("io.ktor:ktor-server-netty:1.4.2")
implementation("org.slf4j:slf4j-simple:1.7.30") // or logback-classic
}
// export SLACK_SIGNING_SECRET=
// export SLACK_BOT_TOKEN=
// gradle run
application {
mainClassName = "MyAppKt" // add "Kt" suffix for main function source file
}
src/main/kotlin/Mypp.kt
import com.slack.api.bolt.App
import com.slack.api.bolt.ktor.respond
import com.slack.api.bolt.ktor.toBoltRequest
import com.slack.api.bolt.util.SlackRequestParser
import io.ktor.application.*
import io.ktor.routing.*
import io.ktor.server.engine.*
import io.ktor.server.netty.*
fun main() {
val app = App()
val requestParser = SlackRequestParser(app.config())
app.command("/hello") { req, ctx ->
ctx.ack("World")
}
val server = embeddedServer(Netty, port = 3000) {
routing {
post("/slack/events") {
respond(call, app.run(toBoltRequest(call, requestParser)))
}
}
}
server.start(wait = true)
}
http4k
build.gradle
dependencies {
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("com.slack.api:bolt-http4k:1.3.0")
implementation("org.slf4j:slf4j-simple:1.7.30") // or logback-classic
}
src/main/kotlin/Mypp.kt
import com.slack.api.bolt.App
import com.slack.api.bolt.http4k.Http4kSlackApp
import org.http4k.server.SunHttp
import org.http4k.server.asServer
fun main() {
val app = App()
app.command("/hello") { req, ctx ->
ctx.ack("World")
}
Http4kSlackApp(app).asServer(SunHttp(3000)).start()
}
Handling app uninstallation events in Bolt
Bolt used to be unable to handle app_uninstalled
and tokens_revoked
events as the built-in authorize
functionalities reject them. Since this version, your listener functions can receive these events for cleaning up your server-side data and/or whatever you want to do at the timing.
app.event(AppUninstalledEvent.class, (req, ctx) -> {
// Do whatever you want to do here
return ctx.ack();
});
app.event(TokensRevokedEvent.class, (req, ctx) -> {
// Do whatever you want to do here
return ctx.ack();
});
Easier way to configure timeouts in API calls
SlackConfig
now has the following properties to configure the timeout settings of underlying OkHttp. You no longer need to manually instantiate OkHttp client instances for this purpose.
SlackConfig config = new SlackConfig();
config.setHttpClientReadTimeoutMillis(60000); // 1 minute
Slack slack = Slack.getInstance(config);
MethodsClient client = slack.methods()
client.apiTest(r -> r.foo("bar"));
Changes
- [bolt] #588 #589 Make OAuth related terms consistent (installPath, redirectUriPath) - Thanks @seratch
- [bolt] #604 #595 Support app_uninstalled, tokens_revoked events in Bolt - Thanks @seratch
- [bolt-http4k] #583 #584 #606 #618 #619 Add support for http4k Bolt adapter - Thanks @daviddenton @seratch
- [bolt-ktor] #585 #590 #606 Add Ktor framework support in Bolt - Thanks @seratch
- [bolt-helidon] #596 Upgrade Helidon SE from 2.0 to 2.1 - Thanks @seratch
- [slack-api-model] #610 #613 timepicker block element support - Thanks @Hariprasad-Ramakrishnan @seratch
- [slack-api-client] #602 #622 Add two admin APIs with binary response support - Thanks @seratch
- [slack-api-client] #609 #612 Provide option to set Connect & Read Timeout for HTTP client - Thanks @anuj-dwivedi @seratch
- [slack-api-client] #599 Add admin.users.session.list API support - Thanks @seratch
- [slack-api-client] #603 Update Audit Logs API to support barrier and some new fields - Thanks @seratch
- [slack-api-client] #614 #615 UsersLookupByEmailResponse's methods are marked as deprecated - Thanks @Przemek-12 @seratch
- [bolt-micronaut] #605 Remove micronaut bom from bolt-micronaut project - Thanks @seratch
- All issues/pull requests: https://github.com/slackapi/java-slack-sdk/milestone/8?closed=1
- All changes: v1.2.1...v1.3.0
version 1.3.0 RC3
version 1.2.1
New Features
Dispatch Action in Block Kit
This pull request adds dispatch_action
flag to input
blocks and dispatch_action_config
field to plain_text_input
block elements.
- https://api.slack.com/reference/block-kit/blocks#input
- https://api.slack.com/reference/block-kit/composition-objects#dispatch_action_config
Changes
- All issues/pull requests: https://github.com/slackapi/java-slack-sdk/milestone/15?closed=1
- All changes: v1.2.0...v1.2.1
version 1.2.0
New Features
Steps from Apps
Workflow Steps from apps allow your app to create and process custom workflow steps that users can add using Workflow Builder. Check the document for details: https://slack.dev/java-slack-sdk/guides/steps-from-apps
import com.slack.api.bolt.App;
import com.slack.api.bolt.middleware.builtin.WorkflowStep;
App app = new App();
WorkflowStep step = WorkflowStep.builder()
.callbackId("copy_review")
.edit((req, ctx) -> { return ctx.ack(); })
.save((req, ctx) -> { return ctx.ack(); })
.execute((req, ctx) -> { return ctx.ack(); })
.build();
app.step(step);
If you are a Koltin developer, try the Kotlin extensions out! With the optional modules, building Workflow Steps can be even more concise!
val step = WorkflowStep.builder()
.callbackId("copy_review")
.edit { _, ctx ->
ctx.configure(withBlocks {
input {
blockId("task_name_input")
element {
plainTextInput {
actionId("task_name")
placeholder("Write a task name")
}
}
label("Task name")
}
})
ctx.ack()
}
.save { req, ctx ->
val values = req.payload.view.state.values
val inputs = mapOf("taskName" to stepInput { it.value(values["task_name_input"]?.get("task_name")?.value) })
val outputs = listOf(stepOutput { it.name("taskName").type("text").label("Task Name") })
ctx.update(inputs, outputs)
ctx.ack()
}
.executeAutoAcknowledgement(false)
.execute { req, ctx ->
val step = req.payload.event.workflowStep
GlobalScope.async {
try {
val email = step.inputs["taskAuthorEmail"]?.value.toString()
val outputs = mapOf("taskName" to step.inputs["taskName"]?.value)
ctx.complete(outputs)
} catch (e: Exception) {
ctx.fail(mapOf("message" to "Something wrong! ($e)"))
}
}
ctx.ack()
}
.build()
val app = App()
app.step(step)
New Events API Payload Support
Events will no longer contain full lists of authed_users or authed_teams
https://api.slack.com/changelog/2020-09-15-events-api-truncate-authed-users
Since this version, this SDK supports newly added authorizations
and is_ext_shared_channel
fields in Events API payloads. Also, the slack-api-client provides the method to call apps.event.authorizations.list API method for fetching the complete set of installations associated with a given event.
If you need a full list of all the parties an event is visible to, you'll call the apps.event.authorizations.list method.
Google Cloud Function extension for Bolt
A new Bolt extension is available for Google Cloud Functions users. This module requires JDK 11+.
package functions;
import com.slack.api.bolt.App;
public class HelloSlack extends SlackApiFunction {
private static final App app = new App();
static {
app.command("/hi", (req, ctx) -> {
return ctx.ack("Hi from Google Cloud Functions!");
});
}
public HelloSlack() { super(app); }
}
// gcloud functions deploy my-first-function \
// --entry-point functions.HelloSlack \
// --runtime java11 --trigger-http --memory 512MB --allow-unauthenticated \
// --set-env-vars SLACK_BOT_TOKEN=$SLACK_BOT_TOKEN,SLACK_SIGNING_SECRET=$SLACK_SIGNING_SECRET
Changes
- [bolt] #569 #571 #574 Steps from Apps support - Thanks @seratch @misscoded
- [bolt] #572 Add
appId
toInstaller
andBot
model classes - Thanks @mihristov @seratch - [bolt] #573 Improve the compatibility with Bolt for JS / Python - Thanks @seratch
- [bolt] #577 Change the fallback behavior of Events API handlers to be compatible with Bolt JS/Python - Thanks @seratch
- [bolt-google-cloud-functions] #498 #550 Add Google Cloud Functions support - Thanks @seratch
- [bolt-helion] Upgrade Helidon SE version from 1.4 to 2.0 - Thanks @seratch
- [slack-app-backend] #576 Add complete support for new Events API payload format - Thanks @seratch
- [slack-api-client] #566 #568 Stop propagation of okhttp's exception message including header values - Thanks @AlexeiZenin @seratch
- [slack-api-client] Add new fields to Audit Logs API response - Thanks @seratch
- [slack-api-client] Upgrade okhttp version from 4.8 to 4.9 - Thanks @seratch
- [*-kotlin-extensions] Upgrade Kotlin language version from 1.3 to 1.4 - Thanks @seratch
- All issues/pull requests: https://github.com/slackapi/java-slack-sdk/milestone/3?closed=1
- All changes: v1.1.6...v1.2.0
version 1.2.0-RC2
Changes
- [bolt] #569 #571 #574 Steps from Apps support - Thanks @seratch @misscoded
- [bolt] #572 Add
appId
toInstaller
andBot
model classes - Thanks @mihristov @seratch - [bolt] #573 Improve the compatibility with Bolt for JS / Python - Thanks @seratch
- [bolt] #577 Change the fallback behavior of Events API handlers to be compatible with Bolt JS/Python - Thanks @seratch
- [bolt-google-cloud-functions] #498 #550 Add Google Cloud Functions support - Thanks @seratch
- [bolt-helion] Upgrade Helidon SE version from 1.4 to 2.0 - Thanks @seratch
- [slack-app-backend] #576 Add complete support for new Events API payload format - Thanks @seratch
- [slack-api-client] #566 #568 Stop propagation of okhttp's exception message including header values - Thanks @AlexeiZenin @seratch
- [slack-api-client] Add new fields to Audit Logs API response - Thanks @seratch
- [slack-api-client] Upgrade okhttp version from 4.8 to 4.9 - Thanks @seratch
- [*-kotlin-extensions] Upgrade Kotlin language version from 1.3 to 1.4 - Thanks @seratch
- All issues/pull requests: https://github.com/slackapi/java-slack-sdk/milestone/3?closed=1
- All changes: v1.1.6...v1.2.0-RC2