Code Monkey home page Code Monkey logo

slack-client's Introduction

slack-client

license GitHub last commit Build Status GitHub release Maven metadata URI

Overview

An asychronous HTTP client wrapping Slack's RPC-style web api. Provides an extensible API with builder-style parameters and responses, allowing you to focus on your interactions with users, rather than your interactions with Slack. Notably, we:

  • Implement most of Slack's web API
  • Actively maintain this project
  • Provide per-method in-memory rate limiting so you don't have to worry about overwhelming slack from a single process
  • Expose highly configurable hooks to allow custom rate limiting, method filtering, and debugging in an extensible way

Breaking Changes

NOTICE:

On October 18th 2019, Slack will stop supporting the replies thread on a Message returned from the conversations.replies endpoint as well as any places that use LiteMessage.

Due to this, we are deprecating getReplies() on LiteMessage It will return the data as long as Slack still returns it, bue when they stop, we will just return an empty array.

More context in the April 2019 changelog

You can continue to use an older version of this client until October 18th, at which time you'll need to upgrade to the latest.

Maintenance

Like most APIs, deprecations and modifications that we'll call "breaking changes" will occur on Slack's web API. General guidelines on detecting and handling "breaking changes" can be found here

Features

We currently support:

auth

  • auth.test
  • auth.revoke

channels

  • channels.history
  • channels.info
  • channels.kick (kickUserFromChannel)
  • channels.list
  • channels.replies (findReplies)

chat

  • chat.delete
  • chat.getPermalink
  • chat.postEphemeral
  • chat.postMessage
  • chat.update
  • chat.scheduleMessage
  • chat.deleteScheduledMessage
  • chat.scheduledMessages.list

conversations

  • conversations.archive
  • conversations.create
  • conversations.history
  • conversations.info
  • conversations.invite
  • conversations.list
  • conversations.members
  • conversations.open
  • conversations.unarchive
  • conversations.setTopic
  • conversations.setPurpose

dialog

  • dialog.open

files

  • files.upload
  • files.sharedPublicURL

groups

  • groups.kick (kickUserFromGroup)
  • groups.list
  • groups.replies (findReplies)

im

  • im.open

reactions

  • reactions.add

search

  • search.messages

team

  • team.info

usergroups

  • usergroups.create
  • usergroups.disable
  • usergroups.enable
  • usergroups.list
  • usergroups.update

usergroups.users

  • usergroups.users.update

users

  • users.conversations
  • users.info (findUser)
  • users.list
  • users.lookupByEmail

views

  • views.open
  • views.update
  • views.push
  • views.publish

Utility Methods

  • getConversationByName
  • getChannelByName

Migration

  • migration.exchange

We happily welcome any PRs for APIs that haven't yet been implemented!

Usage

To use with Maven-based projects, add the following dependencies::

<dependency>
  <groupId>com.hubspot.slack</groupId>
  <artifactId>slack-base</artifactId>
  <version>{latest version}</version>
</dependency>
<dependency>
  <groupId>com.hubspot.slack</groupId>
  <artifactId>slack-java-client</artifactId>
  <version>{latest  version}</version>
</dependency>

Latest version can be seen here, on Maven central.

Setting up Guice

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());
  }
}

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()
          .setTokenSupplier(() -> "your token here")
          // ... all your configuration here
          .build()
    );
  }
  
  // then just use the client!
}

Using the Client

If you're not familiar with Java 8's CompletableFuture API, know that you can transform this client from an asynchronous one to a synchronous one by calling join on any of the futures returned. To simplify getting started, we've included an example module with some common tasks to give you a feel for how you can interact with the client.

Contributors

License

Copyright 2018 HubSpot, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

slack-client's People

Contributors

szabowexler avatar matush-v avatar lightbody avatar zmarushchak-hs avatar omotnyk avatar hs-jenkins-bot avatar mlr46 avatar mindspin311 avatar bwehner avatar motnyk avatar wsorenson avatar ykaliukh avatar kecarroll avatar nliutyi-hs avatar leonidhladii avatar dependabot[bot] avatar aybbr avatar dylanrb123 avatar courtneyadams avatar stevie400 avatar axiak avatar zklapow avatar higityan avatar ssalinas avatar johnnyleitrim avatar vtymtsiv avatar andybergon avatar nliutyi avatar dezuz avatar ulya0302 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.