post_to_slack.rb
require 'net/http'
require 'uri'
require 'json'
uri = URI.parse("https://hooks.slack.com/services/...(あたなのWebhook URL)")
payload = {
text: "テストメッセージ",
channel: "#random",
username: "bot",
icon_emoji: ":ghost:"
}
Net::HTTP.post_form(uri, { payload: payload.to_json })