Skip to content
Slack Developer Kit (including Bolt for Java) for any JVM language
Java Kotlin Other
Branch: master
Clone or download

Latest commit

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Add missing fields in Events API payloads Mar 11, 2020
.mvn/wrapper Bump maven version to 3.6.3 to use --no-transfer-progres Mar 3, 2020
bolt-aws-lambda Start 1.0.2 development Mar 19, 2020
bolt-docker-examples/echo-command-app version 1.0.1 Mar 19, 2020
bolt-helidon Start 1.0.2 development Mar 19, 2020
bolt-jetty Start 1.0.2 development Mar 19, 2020
bolt-kotlin-examples Start 1.0.2 development Mar 19, 2020
bolt-micronaut Start 1.0.2 development Mar 19, 2020
bolt-quarkus-examples Start 1.0.2 development Mar 19, 2020
bolt-servlet Start 1.0.2 development Mar 19, 2020
bolt-spring-boot-examples Start 1.0.2 development Mar 19, 2020
bolt Start 1.0.2 development Mar 19, 2020
docs Add guide for response_urls in modals Mar 28, 2020
json-logs Run all the tests Mar 25, 2020
misc/slack_ruby_app Apply a bunch of changes for the repository transfer Jan 26, 2020
scripts Run all the tests Mar 25, 2020
slack-api-client Run all the tests Mar 25, 2020
slack-api-model Start 1.0.2 development Mar 19, 2020
slack-app-backend Start 1.0.2 development Mar 19, 2020
.gitignore Add App Home support Oct 25, 2019
.travis.yml Add builds with the latest JDK Mar 7, 2020
LICENSE Apply a bunch of changes for the repository transfer Jan 26, 2020
README.md Update README Mar 19, 2020
jSlack_changelog.md Update jslack release notes to refer to the maintenance release repos… Feb 9, 2020
lombok.config Enable CodeCov for this project Feb 25, 2020
maven-versions-rules.xml Bump dependencies Feb 9, 2020
mvnw Bump maven version to 3.6.3 to use --no-transfer-progres Mar 3, 2020
mvnw.bat Add threading messages (#14) Jan 28, 2017
mvnw.cmd Bump maven version to 3.6.3 to use --no-transfer-progres Mar 3, 2020
pom.xml Start 1.0.2 development Mar 19, 2020

README.md

Slack SDK for Java

Maven Central Build Status codecov

Slack SDK for Java supports all public Slack platform functionality in a Java idiomatic way. The SDK is completely written in Java, so that developers can use this SDK in any JVM language, including Kotlin, Groovy, and Scala without any hurdles.

The SDK offers two different modules depending on what platform features you intend to use:

If what you want to do is call Slack APIs in your existing services, we recommend using only the Slack API Client. If instead, you’re developing a new modern and interactive Slack app, we recommend Bolt for it. The framework enables developers to focus on the essential parts of their apps without being bothered by trifles.

Slack API Client

slack-api-client contains simple, easy-to-use, and flexibly configurable HTTP clients for making requests to Slack APIs. Refer to API Client Basics for details.

import com.slack.api.Slack;
import com.slack.api.methods.response.chat.ChatPostMessageResponse;

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

ChatPostMessageResponse response = slack.methods(token).chatPostMessage(req -> req
  .channel("C1234567") // Channel ID
  .text(":wave: Hi from a bot written in Java!"));

Bolt for Java

Bolt for Java is a framework on the JVM that offers an abstraction layer to build Slack apps quickly using modern platform features. Refer to Getting Started with Bolt for detailed instructions.

package hello;

import com.slack.api.bolt.App;
import com.slack.api.bolt.jetty.SlackAppServer;

public class MyApp {
  public static void main(String[] args) throws Exception {
    // App expects env variables (SLACK_BOT_TOKEN, SLACK_SIGNING_SECRET)
    App app = new App();

    app.command("/hello", (req, ctx) -> {
      return ctx.ack(":wave: Hello!");
    });

    SlackAppServer server = new SlackAppServer(app);
    server.start(); // http://localhost:3000/slack/events
  }
}

Modules

The table below shows all the available modules. All of them have the same latest version as we release all at the same time, even in the case that some don't have any changes apart from updates on their dependency side.

All released versions are available on the Maven Central repositories. The latest version is Maven Central.

groupId:artifactId Description
com.slack.api:slack-api-model This module is a collection of the classes representing the Slack core objects such as conversations, messages, users, surfaces, and blocks. As this one is an essential part of the SDK, all others depend on this.
com.slack.api:slack-api-client This is a collection of the Slack API clients. The supported are Basic API Methods, RTM (Real Time Messaging) API, SCIM API, Audit Logs API, and Status API.
com.slack.api:slack-app-backend This module is a set of Slack app server-side handlers and data classes for Events API, Interactive Components, Slash Commands, Actions, and OAuth flow. These are used by Bolt framework as the foundation of it in primitive layers.
com.slack.api:bolt Bolt is a framework that offers an abstraction layer to build Slack apps safely and quickly. The most commonly used Servlet environment is supported out-of-the-box.
com.slack.api:bolt-servlet This is an adapter for Servlet environments.
com.slack.api:bolt-jetty This module offers a handy way to run Bolt apps on the Jetty HTTP server.
com.slack.api:bolt-aws-lambda This module offers a handy way to run Bolt apps on AWS API Gateway + Lambda.
com.slack.api:bolt-micronaut This is an adapter for Micronaut to run Bolt apps on top of it.
com.slack.api:bolt-helidon This is an adapter for Helidon SE to run Bolt apps on top of it.

Requirements

The SDK supports OpenJDK 8 and higher LTS versions.

Users can expect every single patch release has been done after verifying functionality by running the basic CI builds with all LTS versions and all the unit tests have passed at least on the latest LTS version. We don't run comprehensive verifications with all OpenJDK distributions but it should be working with all of them.

Getting Help

If you get stuck, we’re here to help. The following are the best ways to get assistance working through your issue:

Important Notice for jSlack users

The jSlack project has been transferred to @slackapi. The jSlack maintenance releases for security issues or major bugfixes will be continued at https://github.com/seratch/jslack-maintenance-releases .

You can’t perform that action at this time.