Tarumi
===
Tarumi is a super simple library written in Ruby to interact with Slack webhooks. It was written by Abraham Kuri from Icalia Labs.
Table of contents
Configure Slack
Before you can start integrating the gem, you need to first add a webhook to which the bot wil ping and then send out the message, so let's do that:
- Open https://api.slack.com/ and sign in if you haven't
- Go to the Integrations section
- Then look for the Incoming WebHooks integration
- Select the channel you wish to hook the service
- You'll be redirected to a page with some steps to test the webhook, just take note of the token on the left.
You are now ready to go!
Installation & Usage
You can install and use Tarumi as a stand-alone library, to install it just run:
$ gem install tarumi
If you are using Rails, just add it to your Gemfile:
gem "tarumi"
And then run the bundle
command to install it:
$ bundle
A simple example on how to use it is presented below:
require 'tarumi'
slackBot = Tarumi::Bot.new("yourteam", "yourtoken", hash_of_options)
slackBot.ping "A text to post"
The example above will post a message to the #general
channel, but you can easily customize it with the hash of options when initializing the bot:
options = {
username: "usernametopost",
channel: "#anotherchannel",
hook_name: "webhookname"
}
That should be it for you to easily configure the bot and start sending messages.
Contributing
- Fork it ( http://github.com//tarumi/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
Heroes
Abraham Kuri
Copyright and license
Code and documentation copyright 2013-2014 Icalia Labs. Code released under the MIT license.