Created
March 30, 2018 03:13
-
-
Save nesheep5/b6df210c84d88c4793b9c074023022fa to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| require 'net/http' | |
| require 'uri' | |
| require 'json' | |
| # slack通知 | |
| # 事前準備 slackの通知したいチャンネルにincoming webhooksアプリを入れ、webhook urlを取得 | |
| # 実行方法 | |
| # ruby slack_notify.rb 'https://hooks.slack.com/services/XXXXX/YYYYY/ZZZZZ' 'hello!!' | |
| url = ARGV[0] | |
| msg = ARGV[1] | |
| data = { | |
| username: '#deploy-bot', | |
| icon_emoji: ':sushi:', | |
| text: msg | |
| } | |
| res = Net::HTTP.post_form(URI.parse(url), {payload: data.to_json}) | |
| puts res.body |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment