Created
February 23, 2016 15:18
-
-
Save branch14/9976231f2a9430b75f68 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env ruby | |
require 'json' | |
require 'uri' | |
require 'net/http' | |
URL = '<YOUR INCOMING WEBHOOK URL HERE>' | |
MESSAGE = { | |
username: 'monit', | |
text: ARGV * ' ', | |
icon_emoji: ":rotating_light:" | |
} | |
uri = URI(URL) | |
https = Net::HTTP.new(uri.host, uri.port) | |
https.use_ssl = true | |
request = Net::HTTP::Post.new(uri.path) | |
request.body = JSON.unparse(MESSAGE) | |
p response = https.request(request) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment