Created
August 14, 2014 01:18
-
-
Save jtadeulopes/2cda8f9f5364490a557f to your computer and use it in GitHub Desktop.
Slack Bot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'httparty' | |
class SlackRuby | |
include HTTParty | |
base_uri 'slack.com/api' | |
def initialize(token) | |
@token = token | |
end | |
def post_message(args) | |
options = { query: args.merge!(token: @token) } | |
self.class.post('/chat.postMessage', options) | |
end | |
end | |
slack = SlackRuby.new('slack-token-api') | |
puts slack.post_message(channel: 'channel-id', text: 'Oi :)') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment