Skip to content

Instantly share code, notes, and snippets.

@branch14
Created February 23, 2016 15:18
Show Gist options
  • Save branch14/9976231f2a9430b75f68 to your computer and use it in GitHub Desktop.
Save branch14/9976231f2a9430b75f68 to your computer and use it in GitHub Desktop.
#!/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