Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Slack-Ops始めました 初心者向け "slack-notifier" の基本
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
strviola
January 15, 2020
Programming
82
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Slack-Ops始めました 初心者向け "slack-notifier" の基本
strviola
January 15, 2020
More Decks by strviola
See All by strviola
安定したFeature Specを助ける3つの処方箋
strviola
0
1.2k
「確認画面」ベストプラクティス
strviola
0
550
Other Decks in Programming
See All in Programming
Dataformのリポジトリを立ち上げるときにまずやること / dataform-day0-2026
snhryt
0
170
Signal Forms: Details & Live Coding @enterJS 2026 in Mannheim
manfredsteyer
PRO
0
160
そのテスト、説明できますか?~LWテスト戦略FW~のご紹介
nakahara
0
150
Make SRE Operations Easier with Azure SRE Agent
kkamegawa
0
6.7k
net-httpのHTTP/2対応について
naruse
0
500
作って学ぶ、 JSX (TSX) ランタイムの基本
syumai
7
1.6k
Vue × Nuxt × Oxc どこまで使える?実運用の現在地
andpad
0
260
軽量Java基盤の設計 DIコンテナに頼らない、長期保守と1秒起動の実現 JJUG CCC 2026 Spring
macha64
0
540
C# and C++ Interoperability - cho-dotnetnew
harukasao
0
200
Developing with AI Agents — Codex, Claude Code & Cowork Practical Guide
x5gtrn
PRO
0
1.3k
例外の正しい扱い方 そのエラー try-catchして大丈夫?
jinwatanabe
0
260
Datadog × OpenTelemetry 入門と実践のあいだ
kn_to_maxpno
1
160
Featured
See All Featured
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
230
How to train your dragon (web standard)
notwaldorf
97
6.7k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
11k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
62
54k
How to Ace a Technical Interview
jacobian
281
24k
Testing 201, or: Great Expectations
jmmastey
46
8.2k
The Curious Case for Waylosing
cassininazir
1
390
Accessibility Awareness
sabderemane
1
140
Everyday Curiosity
cassininazir
0
230
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.8k
Transcript
4MBDL0QT͡Ί·ͨ͠ ॳ৺ऀ͚TMBDLOPUJpFSͷجຊ ϦϯΧʔζגࣜձࣾླཽଠ
ຊͷ࣍ TMBDLOPUJpFSHFNͷհ ॳظઃఆ "1*ͷհ 4MBDL0QTͷ͋Δࣄ
·ͱΊͱࠓޙͷ՝
TMBDLOPUJpFSHFNͷհ w IUUQTHJUIVCDPNTUFWFOPTMPBOTMBDLOPUJpFS w ཁ͢Δʹ)BTIΛ+40/ʹͯ͠)5511045ͯ͘͠ΕΔ # Gemfile gem 'slack-notifier' #
test.rb require 'slack-notifier' notifier = Slack::Notifier.new('WEBHOOK_URL') notifier.ping 'Hello World' # POST https://hooks.slack.com/services/... # Content-type: application/json # { "text": "Hello World" }
ॳظઃఆ w 8FCIPPL63-ͷऔಘ w IUUQTTMBDLDPNBQQT"'9%6";JODPNJOHXFCIPPLTʹΞΫηε w ϫʔΫεϖʔεɺߘઌνϟϯωϧͳͲઃఆ w 63-ઃఆը໘͔Β͍ͭͰ֬ೝߋ৽Մೳ
ॳظઃఆ w 8FCIPPL63-ͷอଘ w DPOpHTFDSFUTZNMFOD͕ແ w ڞ௨Ϋϥε͔Βݺͼग़͠ ฐࣾ"QQMJDBUJPO3FDPSE
w BUUBDINFOUT"1*ʹ͢+40/ # app/models/application_record.rb def slack_webhook_url Rails.application.secrets.slack_webhook_url end def slack_post!(attachments:, webhook_url: slack_webhook_url, username: 'LFB bot') return if webhook_url.blank? notifier = Slack::Notifier.new(webhook_url, username: username) notifier.post attachments: attachments end
"1*ͷհ color pretext title title_link fields[0] fields[1] footer title
title value value
"1*ͷհ # app/models/contact.rb def slack_notify!(host, title: '͓٬༷͔Β͍߹Θ͕ͤ͋Γ·ͨ͠ɻ') url_helper =
Rails.application.routes.url_helpers attachment = { color: '#1155A7', pretext: '<!channel>', title: title, title_link: url_helper.system_managers_contact_url(self, host: host), fields: [ { title: 'ۜߦ໊', value: Bank.current.name }, { title: '͓٬༷ࢯ໊', value: "#{user.name}༷" } ], footer: "#{Rails.env} environment" } slack_post! attachments: [attachment] end
·ͱΊ w TMBDLOPUJpFSHFNͷհ w 8FCIPPL63-ͷऔಘํ๏ w "1*ͷհ w ࠓޙͷ՝ w
ϋοϐʔʹͳΕΔ4MBDL0QT ͍߹ΘͤରԠ͚ͩͩͱؾ͕໓ೖΔ 4MBDLಋೖΰʔϧ͡Όͳ͍ɺελʔτͩ