26 lines
560 B
Ruby
26 lines
560 B
Ruby
require "uri"
|
|
require "net/http"
|
|
|
|
namespace :slack do
|
|
desc "TODO"
|
|
task webhook: :environment do
|
|
out = {}
|
|
out[:text] = "Hello World"
|
|
out[:color] = "good"
|
|
out[:pretext] = "pretext!"
|
|
|
|
|
|
|
|
uri = URI.parse('https://hooks.slack.com/services/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')
|
|
http = Net::HTTP.new(uri.host, uri.port)
|
|
http.use_ssl = true
|
|
|
|
|
|
request = Net::HTTP::Post.new(uri.path, {'Content-Type' =>'application/json'})
|
|
request.body = out.to_json
|
|
|
|
response = http.request(request)
|
|
puts response.body
|
|
end
|
|
end
|