Slack is a mashup of chatrooms and collaborative sharing tools that are meant to do away with redundant conversations in multiple places.
slack-poster is a simple gem to make your integration with Slack easier. It supports only incoming communications (from you to Slack).
Add this line to your application's Gemfile:
$ gem 'slack-poster'
And then execute:
$ bundle
Or install it yourself as:
$ gem install slack-poster
Just create a new poster and send the message:
TEAM = 'my-test-team'
TOKEN = 'hd7heoo2oijd0'
poster = Slack::Poster.new(TEAM, TOKEN)
poster.send_message('Hello, world!')
You can use an options array if you don't want to use the settings configured directly on Slack:
options = {
icon_url: 'http://example.com/image.png',
# or icon_emoji: 'emoji_name',
username: 'Tester',
channel: '#random'
}
And then use it as a third parameter. Note that every option is optional (no pun intended!).
poster = Slack::Poster.new(TEAM, TOKEN, options)
poster.send('Hi!') # will send to #random with the username 'Tester'
That's it!
- Fork it ( http://github.com/rikas/slack-poster/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