Ruby toolkit for working with the Slack API
Add this line to your application's Gemfile:
gem 'slack'
And then execute:
$ bundle
Or install it yourself as:
$ gem install slack
# Provide authentication credentials
client = Slack::Client.new(team: 'netflower', token: 'xxxx-xxxxxxxxx-xxxx')
# Post a message
client.post_message("May the force be with you", "yoda-quotes")
# List all channels
client.channelsEvery writable attribute in {Slack::Configurable} can be set one at a time:
Slack.api_endpoint = 'https://slack.dev/api'
Slack.default_channel = '#lol-cats'
Slack.username = 'Yoda'or in batch:
Slack.configure do |c|
c.api_endpoint = 'https://slack.dev/api'
c.default_channel = '#lol-cats'
c.username = 'Yoda'
endDefault configuration values are specified in {Slack::Default}. Many attributes will look for a default value from the ENV before returning Slack's default.
# Given $SLACK_API_ENDPOINT is "https://slack.dev/api"
Slack.api_endpoint
# => "https://slack.dev/api"- Fork it ( http://github.com/netflower/slack.rb/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 new Pull Request
