Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
GASでSlackBot
Search
takuaraki
August 22, 2018
Programming
1
540
GASでSlackBot
Google App Scriptsを利用して勤怠管理のSlackBotを作った話です。
takuaraki
August 22, 2018
Tweet
Share
More Decks by takuaraki
See All by takuaraki
2021/02/03 発覚の COCOA Android版 不具合について
takuaraki
0
57
Androidアプリ内課金のテスト
takuaraki
0
460
Material Design Guideline: Dialogs, Dividers
takuaraki
0
420
Material Design Guideline: Bottom components
takuaraki
0
520
App Shortcuts
takuaraki
0
370
[関モバ#18] SQLBrite&SQLDelight
takuaraki
0
480
A/B testing GTM&GA vs Firebase
takuaraki
1
2.9k
【関モバ#12】Google Tag ManagerでモバイルアプリのABテストをする
takuaraki
1
660
Other Decks in Programming
See All in Programming
Java_プロセスのメモリ監視の落とし穴_NMT_で見抜けない_glibc_キャッシュ問題_.pdf
ntt_dsol_java
0
230
jakarta-security-jjug-ccc-2025-fall
tnagao7
0
100
社内オペレーション改善のためのTypeScript / TSKaigi Hokuriku 2025
dachi023
1
130
Reactive Thinking with Signals and the new Resource API
manfredsteyer
PRO
0
130
しっかり学ぶ java.lang.*
nagise
1
460
Building AI Agents with TypeScript #TSKaigiHokuriku
izumin5210
5
1.1k
『実践MLOps』から学ぶ DevOps for ML
nsakki55
2
490
Full-Cycle Reactivity in Angular: SignalStore mit Signal Forms und Resources
manfredsteyer
PRO
0
150
CloudNative Days Winter 2025: 一週間で作る低レイヤコンテナランタイム
ternbusty
7
1.8k
全員アーキテクトで挑む、 巨大で高密度なドメインの紐解き方
agatan
8
11k
知られているようで知られていない JavaScriptの仕様 4選
syumai
0
640
なあ兄弟、 余白の意味を考えてから UI実装してくれ!
ktcryomm
10
9.4k
Featured
See All Featured
Unsuck your backbone
ammeep
671
58k
Being A Developer After 40
akosma
91
590k
KATA
mclloyd
PRO
32
15k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Faster Mobile Websites
deanohume
310
31k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
61k
Testing 201, or: Great Expectations
jmmastey
46
7.8k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.1k
Why Our Code Smells
bkeepers
PRO
340
57k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
359
30k
RailsConf 2023
tenderlove
30
1.3k
Transcript
("4Ͱ4MBDL#PU ߥ !BSB@UBDL
"CPVU.F w ߥ !BSB@UBDL w '63:6$PSQ w "OESPJEͬͯ·͢ w
,PUMJOॻ͍ͯ·͢
࠷ۙͷۈଵཧ 4MBDLͰͬͯ·͢
͜Μͳײ͡
4MBDLͰͷۈଵཧ w ϝʔϧΑΓָͰྑ͍ײ͡ w ࠓɺ୭͕ٳΉͷ͔ḪΒͳ͍ͱ͔Βͳ͍ w ேྱͰಉ͡νʔϜͷਓ͕Θ͟Θ͟ใࠂͯͨ͠ ˠࠓɺٳΉਓ͕4MBDLͰ௨͞ΕͨΒ͍͍ͳʔ
,JOUBJ#PU࡞Γ·ͨ͠ OBNF OBNF OBNF OBNF
,JOUBJ#PU w 4MBDLͰͷɺΈΜͳͷۈଵൃݴΛه w ຖேɺͦͷͷରऀΛूܭ w ໊લೖྗຊจΛ·ͱΊͯߘ OBNF OBNF OBNF
OBNF
ͬͨͷ w 4MBDL0VUHPJOH8FC)PPLT w (PPHMF"QQT4DSJQU ("4 w (PPHMFεϓϨουγʔτ
0VUHPJOH8FC)PPLT w 4MBDLͷಛఆͷจࣈΛؚΉߘʹԠ͢Δ w ࢦఆͨ͠63-ʹ1045ϦΫΤετΛ͛Δ w ϦΫΤετύϥϝʔλ͕ߘϢʔβʔ໊ɺ ߘϝοηʔδͳͲΛؚΉ
(PPHMF"QQT4DSJQU w +BWBTDSJQUޓͷεΫϦϓτݴޠ w (PPHMFυΩϡϝϯτεϓϨουγʔτͳͲͷ (PPHMF"QQTΛૢ࡞Ͱ͖Δ w ࣌ؒ)551ϦΫΤετΛτϦΨʔʹͯ͠ ಈ͔͢͜ͱ͕Ͱ͖Δ
γεςϜߏ ("4 ۈଵه (PPHMF 4QSFBE 4IFFU ("4 ۈଵूܭ 0VUHPJOH 8FC)PPLT
ۈଵೖྗ ࠓͷۈଵʁ ूܭ݁Ռදࣔ 1045 ϦΫΤετ σʔλΛ ه σʔλΛ औಘ 1045 ϦΫΤετ ूܭ݁ՌΛ 4MBDLʹߘ
γεςϜߏ ("4 ۈଵه (PPHMF 4QSFBE 4IFFU ("4 ۈଵूܭ 0VUHPJOH 8FC)PPLT
ۈଵೖྗ ࠓͷۈଵʁ ूܭ݁Ռදࣔ 1045 ϦΫΤετ σʔλΛ ه σʔλΛ औಘ 1045 ϦΫΤετ ूܭ݁ՌΛ 4MBDLʹߘ
ۈଵهɿ4MBDL w ۈଵൃݴશһ΄΅ಉ͡ϑΥʔϚοτͩͬͨ ྫ ʲશٳʳʢਫʣࢲ༻ͷͨΊ w ʮʲʯΛτϦΨʔʹ0VUHPJOH8FC)PPLTͰ ه༻ͷ("4ʹ1045ϦΫΤετΛૹ৴ w 1045ϦΫΤετʹߘऀͱຊจ͕ࡌ͍ͬͯΔ
ۈଵهɿ("4 w 4MBDL͔Β1045ϦΫΤετΛड͚Δ w ຊจ͔Βਖ਼نදݱͰΛநग़͢Δ ͜ͷΛɺٳΉͱͯ͠ѻ͏ ྫ ʲશٳʳʢਫʣࢲ༻ͷͨΊˠ w ٳΉɺߘऀɺຊจΛεϓϨουγʔτʹه
ۈଵهɿ("4 function doPost(e) { // ରͷΛநग़ var pattern = /(?:\d{4}\/|)([1-9]|0[1-9]|1[0-2])\/([1-9]|0[1-9]|[12][0-9]|3[01])/;
var matchResult = e.parameter.text.match(pattern); var date = new Date().getFullYear() + "/" + matchResult[1] + "/" + matchResult[2]; // εϓϨουγʔτʹɺ໊લɺຊจΛه var sheet = getCurrentYearSpreadsheet().getSheets()[0]; var kintaiValues = sheet.getSheetValues(1, 1, maxRowCount, 3); var newLineRow = -1; for (var row = 0; row < 10000; row++) { var dateCell = kintaiValues[row][0]; if (dateCell == "") { newLineRow = row + 1; break; } } arrData = [ [date, e.parameter.user_name, e.parameter.text] ]; sheet.getRange(newLineRow, 1, 1, 3).setValues(arrData); }
%FNP ʮʲશٳʳʢਫʣࢲ༻ͷͨΊʯͱଧͬͯɺ εϓϨουγʔτʹՃ͞ΕΔͷΛݟͯΈΔ
γεςϜߏ ("4 ۈଵه (PPHMF 4QSFBE 4IFFU ("4 ۈଵूܭ 0VUHPJOH 8FC)PPLT
ۈଵೖྗ ࠓͷۈଵʁ ूܭ݁Ռදࣔ 1045 ϦΫΤετ σʔλΛ ه σʔλΛ औಘ 1045 ϦΫΤετ ूܭ݁ՌΛ 4MBDLʹߘ
γεςϜߏ ("4 ۈଵه (PPHMF 4QSFBE 4IFFU ("4 ۈଵूܭ 0VUHPJOH 8FC)PPLT
ۈଵೖྗ ࠓͷۈଵʁ ूܭ݁Ռදࣔ 1045 ϦΫΤετ σʔλΛ ه σʔλΛ औಘ 1045 ϦΫΤετ ूܭ݁ՌΛ 4MBDLʹߘ
ۈଵूܭɿ4MBDL w ࠓͷۈଵʁͱ͍͏4MBDLϦϚΠϯμʔΛ ࢝ۀͷલʹηοτ SFNJOE,JOUBJUPࠓͷۈଵʁBUFWFSZXFFLEBZ w ࠓͷۈଵʁΛτϦΨʔʹ0VUHPJOH8FC)PPL Ͱूܭ༻ͷ("4ʹ1045ϦΫΤετ
ۈଵूܭɿ("4 w ۈଵهͷεϓϨουγʔτΛಡΈࠐΉ σʔλɺߘऀɺຊจ w ݱࡏͱಉ͡ͷσʔλ͚ͩநग़ w நग़ͨ͠σʔλ͔Β4MBDLߘ༻ͷจΛ࡞ͯ͠ 4MBDLʹߘ͢Δ
ۈଵूܭɿ("4 function doPost(e) { var now = new Date(); var
slackMessage = "```\n”; var sheet = getCurrentYearSpreadsheet().getSheets()[0]; var kintaiValues = sheet.getSheetValues(1, 1, maxRowCount, 3); for (var row = 1; row < 10000; row++) { var date = kintaiValues[row][0]; if (date == "") { break; } // ݱࡏͱಉ͡σʔλ͚ͩநग़ͯ͠ɺߘ༻ϝοηʔδʹՃ if (date.getFullYear() == now.getFullYear() && date.getMonth() == now.getMonth() && date.getDate() == now.getDate()) { var name = kintaiValues[row][1]; var text = kintaiValues[row][2]; slackMessage += name + " " + text + "\n"; } } slackMessage += "```"; sendToSlack(slackMessage); }
%FNP ʮࠓͷۈଵʁʯͱଧͬͯɺ ूܭ݁Ռ͕ߘ͞ΕΔͷΛݟͯΈΔ
࡞ͬͨײ w (PPHMFυϥΠϒ্Ͱ݁ͨ͠ͷͰָͩͬͨ w (PPHMF"QQT4DSJQU໘ന͍ɻ͍Ζ͍ΖͰ͖ͦ͏ w #PUՄѪ͍ɻ༊͞ΕΔ ࡞ͬͯΈ͍͔͕ͯʁ
ࠓޙΓ͍ͨ͜ͱ w ՄѪ໊͍લͱΞΠίϯΛ͚͍ͭͨ w ʹόάΔ͜ͱ͕Θ͔͍ͬͯΔͷͰͳΜͱ͔͢Δ w ΑΓ៉ྷͳϑΥʔϚοτͰूܭΛߘ͢Δ w औΓফ͠ػೳΛ͚ͭΔ w
ϒϩάʹ·ͱΊΔ