Slack::Ruby
A Ruby interface to Slack API.
Installation
Add this line to your application's Gemfile:
gem 'slack-ruby'
And then execute:
$ bundle
Or install it yourself as:
$ gem install slack-ruby
Usage
How to use RPC-Style Web API
require "slack"
# create RPC client object with OAuth token
client = Slack::RPC::Client.new("xxxx-xxxxxxxxx-xxxx")
# or you can set OAuth token after initialization
client = Slack::RPC::Client.new()
client.token = "yyyy-yyyyyyyyy-yyyy"
# execute RPC command and retrieve response
client.channels.archive(:channel => "C1234567890") do |response|
# your own code
end
# or you can get response as returned object
response = client.channels.archive(:channel => "C1234567890")
# your own code
RPC command
Response object
Slack::RPC::Response.status
is HTTP status code as integerSlack::RPC::Response.headers
is HTTP response header as Hash objectSlack::RPC::Response.body
is HTTP response body as Hash object
How to use Real Time Messaging API
TODO
Contributing
- Fork it ( https://github.com/morou/slack-ruby/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