clj-slack is a Clojure library to talk to the Slack REST API. It supports almost the entire Slack API.
Slack API methods are described here.
clj-slack documentation is available here.
This is on Clojars of course. Just add [org.julienxx/clj-slack "0.5.4"]
to your :dependencies
in your project.clj file.
Get your access token here.
Your need to create a connection map like {:api-url "https://slack.com/api" :token "YOUR TOKEN"}
and pass it as the first argument of every functions in clj-slack. Of course you can change api-url for debugging or testing purposes.
clj-slack will throw an Exception if the connection map you're trying to use is not valid.
Example:
(require 'clj-slack.users)
(def connection {:api-url "https://slack.com/api" :token "YOUR TOKEN"})
(clj-slack.users/list connection)
You can use optional params described in Slack API by passing them through a map.
(require 'clj-slack.stars)
(def connection {:api-url "https://slack.com/api" :token "YOUR TOKEN"})
(clj-slack.stars/list connection {:count "2" :page "3"})
Uploading a file:
(require 'clj-slack.files)
(def connection {:api-url "https://slack.com/api" :token "YOUR TOKEN"})
(clj-slack.files/upload connection (clojure.java.io/input-stream "/path/to/file/file.ext") {:channels "CHANNEL_ID", :title "This is a file.})
- Add tests
Copyright (C) 2014-2015 Julien Blanchard
Distributed under the Eclipse Public License, the same as Clojure.