/slackhook

Easily add Slack Webhook integration to your Ruby application.

Primary LanguageRubyMIT LicenseMIT

Slackhook

Easily add Slack WebHooks integration and send messages from your Ruby application.

Installation

Add this line to your application's Gemfile:

gem 'slackhook'

And then execute:

$ bundle

Or install it yourself as:

$ gem install slackhook

Usage

To use this gem you only need to configure the Incoming WebHook integration in Slack.

You can find this using your slack account and going to Incoming WebHooks and select your default channel.

Well, now you are ready to send messages to Slack channels \0/!

Quick start

# This is how you send messages to your default channel.
Slackhook.send_hook({webhook_url: "your_webhook_url", text: "test message"})

There are also username and icon_type (slackbot is the default) options to be more specific about the nickname and avatar which would appear on the chat.

You can use the channel option if the message is goint to be sent to a non default channel.

> require "slackhook"
> Slackhook.send_hook({ webhook_url: "your_webhook_url",
                        text: "test message",
                        channel: "@your-channel",
                        username: "testbot",
                        icon_type: ":trollface:"})

You can also use icon_url instead of icon_type if you want to use some additional icon image.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors