Skip to content

matush-v/slack-client

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

slack-client

An asychronous HTTP client wrapping Slack's RPC-style web api. The API here is simple: you just need a SlackClient and you're good to go.

Usage

Include the base and client modules in your POM:

<dependency>
  <groupId>com.hubspot</groupId>
  <artifactId>slack-public-base</artifactId>
  <version>1.0</version>
</dependency>
<dependency>
  <groupId>com.hubspot</groupId>
  <artifactId>slack-java-client</artifactId>
  <version>1.0</version>
</dependency>

Install the SlackClientModule in the Guice module you want to use to talk to slack.

public class MyFancyModule extends AbstractModule {
  @Override
  protected void configure() {
    install(new SlackClientModule());
  }

  @Override
  public boolean equals(Object o) {
    return o != null && getClass().equals(o.getClass());
  }

  @Override
  public int hashCode() {
    return getClass().hashCode();
  }
}

Finally inject the factory where you want to build the client:

public class MySlacker {
  private final SlackClient slackClient;
  
  
  public MySlacker(
      SlackWebClient.Factory clientFactory
  ) {
    this.slackClient = clientFactory.build(
        SlackClientRuntimeConfig.builder()
          // ... all your configuration here
          .builder()
    );
  }
  
  // then just use the client!
}

About

A simple HTTP client for Slack's web API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%