HubSpot/simple-slack-api

Name: simple-slack-api

Owner: HubSpot

Description: (simple) Java Slack client library

Forked from: Ullink/simple-slack-api

Created: 2017-09-13 20:26:18.0

Updated: 2018-02-04 16:29:40.0

Pushed: 2018-02-20 16:49:20.0

Homepage:

Size: 1474

Language: Java

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

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 :

How to use it ?

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

Sample code

kSession session = SlackSessionFactory.createWebSocketSlackSession("slack-bot-auth-token");
ion.connect();
kChannel channel = session.findChannelByName("general"); //make sure bot is a member of the channel.
ion.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)

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

GenericSlackCommand(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)

Thanks

Many thanks to everyone who has contributed to this library :

(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.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.