• Stars
    star
    470
  • Rank 93,399 (Top 2 %)
  • Language
    Java
  • Created about 10 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

(simple) Java Slack client library

Build Status GitHub release Coverage Status Join the chat at https://gitter.im/Ullink/simple-slack-api

Simple Slack API

This library allows an application to connect to Slack to receive and send messages from any channel as if it were a slack client.

The main purpose of this library is to build Slack bots able to react to channel events without having to configure any web hook.

With this library you should be able to connect to Slack and to send some messages in less than 20 lines (no one-liners).

Maven/Gradle

You can add this library as a dependency to your Maven or Gradle project through JitPack.

Released versions are also availables on the maven central repository :

  • group id: com.ullink.slack
  • artifact id: simpleslackapi

How to use it ?

You can find some samples of the most common use cases in the samples folder.

Sample code

SlackSession session = SlackSessionFactory.createWebSocketSlackSession("slack-bot-auth-token");
session.connect();
SlackChannel channel = session.findChannelByName("general"); //make sure bot is a member of the channel.
session.sendMessage(channel, "hi im a bot" );

Features

Supported Slack commands

All these commands can be sent through the library provided your bot has the rights to (IE : the bot has to be a member of the group or the channel to post some messages on it)

  • Post a message on a channel / private group / user
  • Post a typing indicator on a channel
  • Update a message
  • Delete a message
  • Join a channel
  • Leave a channel / a private group
  • Invite to a channel / a private group
  • Archive a channel
  • Open a direct message channel (since v0.5.0)
  • Open a multiparty direct message channel (since v0.5.0)
  • Get the presence status of a user
  • Add a reaction emoji to a message
  • Fetch the channel history (since v0.5.0) (needs full user credentials)
  • Invite a user to Slack (since v0.5.0)

On top of these built-in features, it is now possible to send not yet implemented API calls by using the postGenericSlackCommand method :

postGenericSlackCommand(Map<String, String> params, String command);

Supported Slack events

All these events can be listen provided your bot has the rights to (IE : the bot has to be a member of the group or a channel to gets the message events related to it)

  • message posted event
  • message deleted event
  • message updated event
  • channel created event
  • channel / private group deleted event
  • channel / private group archived event
  • channel / private group unarchived event
  • channel / private group renamed event
  • channel / private group joined event
  • reaction added to message event (since v0.5.0)
  • reaction removed from message event (since v0.5.0)
  • team joined event

Attention

From version 1.4.0 upward, channel members are not loaded in memory anymore in order for the api to start up faster. This should have no impact on the current behavior.

Thanks

Many thanks to everyone who has contributed to this library :

  • Christian Sprecher
  • Jan Vidar Krey
  • David Seebacher
  • Wouter Vernaillen
  • Claudio Comandini
  • Maxim Gurkin
  • Ole Kozaczenko
  • Georges Gomes
  • François Valdy
  • Harry Fox
  • Logan Clément
  • Rhys Kenwell
  • Aman Gupta
  • Miklos Sagi
  • Nathalie Mahe
  • Sebastien Lelouvier
  • Nicolas Haquet

(Let me know if I forgot someone, I'll fix that ASAP ;) )

License

This library is licensed under the Creative Commons CC0 1.0 Universal license with no warranty (expressed or implied) for any purpose.

More Repositories

1

gradle-msbuild-plugin

Gradle plugin for msbuild execution, supports C# project files for now
Groovy
102
star
2

gradle-nuget-plugin

Executes NuGet from a gradle build
Groovy
22
star
3

ordered-scheduler

Unlock code that have sequence / ordering requirements
Java
20
star
4

gradle-dotnet-plugin

Gradle plugin for interacting with dotnet cli
Kotlin
18
star
5

gradle-repositories-plugin

Gradle plugin to extend repository definition for GitHub, SourceForge, GoogleCode & NuGet
Groovy
18
star
6

gradle-nunit-plugin

A gradle plugin for launching NUnit tests
Groovy
17
star
7

gerrit-coverage-plugin

A Gerrit plugin for make coverage information available at review-time
Java
16
star
8

gradle-ikvm-plugin

Gradle plugin for IKVM artifact compilation
Java
14
star
9

git-react-client

Frontend to git-grep REST API, allows to grep through multiple bare repositories
TypeScript
9
star
10

jira-slackit

Plugin for JIRA to allow integration with Slack
JavaScript
8
star
11

slack4gerrit

Slack bot for gerrit integration
Java
7
star
12

gradle-opencover-plugin

A gradle plugin for getting test coverage using OpenCover
Groovy
6
star
13

gradle-test-export-plugin

Groovy
5
star
14

git-bare-node-rest-api

Provides a REST API over a set of bare git repositories
JavaScript
5
star
15

gradle-jibx-plugin

Groovy
4
star
16

gradle-pdbindex-plugin

Gradle plugin to run PDB indexing on debug files
Groovy
4
star
17

lunch-box

TBDNA
Java
3
star
18

performance-trends

Java
3
star
19

fix-repo

npm package for easy accessible FIX Repository information
TypeScript
2
star
20

NugetConverter

Watch and convert in realtime directories storing simples dlls hierarchically to a fully fonctionnal Nuget repository managing dependencies
C#
1
star
21

CEFPopupIntegration

Demonstrate Integration of Popup/Secondary Windows as Winform panel
C#
1
star
22

process-diagnostics

Command line utility to create memory and call stack dumps based on CLRMD
C#
1
star
23

spek-junit-rules

Library which allows limited use of JUnit 4 rules with Spek
Kotlin
1
star
24

ulodisys-client.js

UL ODISYS Node.Js client library
JavaScript
1
star
25

gradle-tools-plugin

Originates from https://github.com/gluck/gradle-scripts that have been pluginified
Groovy
1
star
26

MemoryDumpObjectsRestore

Restore objects from memory dumps
C#
1
star
27

gradle-editbin-plugin

Groovy
1
star
28

rx-shim

Rx to await for .Net 4.0
C#
1
star
29

rxjava-test-extras

Handy testing utilities for RxJava
Java
1
star
30

deadlock-free-ssl-provider

a ssl provider extracted from OpenJDK6-b27
Java
1
star
31

gradle-gallio-plugin

Gradle plugin for gallio tests execution
Groovy
1
star
32

beerbot

a beer bot for slack
Clojure
1
star