Slack::Client
A basic Slack API client written in Ruby. Currently the client returns the raw JSON response it receives from Slack's server.
Installation
Add this line to your application's Gemfile:
gem 'slack-client'
And then execute:
$ bundle
Or install it yourself as:
$ gem install slack-client
Usage (API Client)
require 'slack/client'
SLACK_API_TOKEN="<your Slack API token goes here>"
client = Slack::Client.new(token: SLACK_API_TOKEN)
puts client.users.list
puts client.channels.list
puts client.channels.history('C1234567')
Usage (Command-Line App)
We recommend installed jq, a flexible command-line JSON processor. Here are some basic commands:
$ slack help
$ slack config set SLACK_TOKEN="<your Slack API token goes here>"
$ slack users list
$ slack channels info
$ slack channels history C1234567
With jq
, you can do things like
$ slack users list | jq '.members | map({(.id): .name})'
which will print out a list of Slack User ID + Name pairs.
Contributing
- Fork it (https://github.com/codeunion/slack-client/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request