LoginSignup
14
11

More than 5 years have passed since last update.

SlackのIncoming Webhooksにポストするだけの簡単なRubyスクリプト

Posted at
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 })
14
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
11