工数表書き忘れ防止機能を作ってみた 〜 GASを使ったSlackへの自動通知 〜

E64f3643aecc58df71d40b42947d1bf6?s=47 sugar
December 14, 2018

工数表書き忘れ防止機能を作ってみた 〜 GASを使ったSlackへの自動通知 〜

Frontend Nagoya #7

E64f3643aecc58df71d40b42947d1bf6?s=128

sugar

December 14, 2018
Tweet

Transcript

  1. ޻਺දॻ͖๨Ε๷ࢭػೳ Λ࡞ͬͯΈͨ ʙ GASΛ࢖ͬͨSlack΁ͷࣗಈ௨஌ ʙ 2018೥12݄14೔ FrontEndNagoya#7 ੁݪ ࠼

  2. ޻਺දॻ͖๨Ε๷ࢭػೳ Λ࡞ͬͯΈͨ ʙ GASΛ࢖ͬͨSlack΁ͷࣗಈ௨஌ ʙ 2018೥12݄14೔ FrontEndNagoya#7 ੁݪ ࠼ ࢼ࡞൛ʂ

  3. ϓϩϑΟʔϧ ໊લɿੁݪ࠼ ॴଐɿ༗ݶձࣾΞοϓϧοϓϧ ʢ2018೥3݄ೖࣾʣ ৬छɿϚʔΫΞοϓΤϯδχΞ ʢϑϩϯτΤϯυΤϯδχΞͱ໊৐ΕΔΑ͏ʹͳΓ͍ͨ…ʣ

  4. օ͞ΜɺGAS Λ͝ଘ஌Ͱ͔͢ʁ ʢ Google Apps Script ʣ

  5. GAS ʢ Google Apps Script ʣͱ͸ʁ

  6. GAS ʢ Google Apps Script ʣͱ͸ʁ Google Apps Script͸ɺG Suiteͱ౷߹͞ΕͨϏδωε

    ΞϓϦέʔγϣϯΛਝ଎͔ͭ؆୯ʹ࡞੒Ͱ͖Δɺ ਝ଎ͳΞϓϦέʔγϣϯ։ൃϓϥοτϑΥʔϜͰ ͢ɻJavaScriptͰίʔυΛهड़͠ɺGmailɺΧϨϯ μʔɺυϥΠϒͳͲͷ޷͖ͳG SuiteΞϓϦέʔ γϣϯ༻ͷ૊ΈࠐΈϥΠϒϥϦʹΞΫηεͰ͖· ͢ɻΠϯετʔϧ͢Δ΋ͷ͸Կ΋͋Γ·ͤΜɻϒ ϥ΢βʹίʔυΤσΟλΛΠϯετʔϧ͠ɺ GoogleͷαʔόʔͰεΫϦϓτΛ࣮ߦ͠·͢ɻ Ҿ༻ݩɿhttps:/ /developers.google.com/apps-script/overview
  7. GAS ʢ Google Apps Script ʣͱ͸ʁ Google ͕ఏڙ͍ͯ͠Δ JavaScript Λϕʔεʹ

    ͨ͠ϓϩάϥϛϯάݴޠɻ
  8. GAS ʢ Google Apps Script ʣͱ͸ʁ Google ͕ఏڙ͍ͯ͠Δ JavaScript Λϕʔεʹ

    ͨ͠ϓϩάϥϛϯάݴޠɻ ͦͷಛ௃͸ʁ
  9. GAS ʢ Google Apps Script ʣͱ͸ʁ Google ͕ఏڙ͍ͯ͠Δ JavaScript Λϕʔεʹ

    ͨ͠ϓϩάϥϛϯάݴޠɻ
  10. GAS ʢ Google Apps Script ʣͱ͸ʁ Google ͕ఏڙ͍ͯ͠Δ JavaScript Λϕʔεʹ

    ͨ͠ϓϩάϥϛϯάݴޠɻ ؆୯ʹʂ ࿈ܞ&ૢ࡞Ͱ͖Δʂ
  11. ࠓ೔ͷຊ୊

  12. ࠓ೔ͷຊ୊ ޻਺දॻ͖๨Ε๷ࢭػೳ Λ࡞ͬͯΈͨ ʙ GASΛ࢖ͬͨSlack΁ͷࣗಈ௨஌ ʙ

  13. ࠓ೔ͷຊ୊ ޻਺දॻ͖๨Ε๷ࢭػೳ Λ࡞ͬͯΈͨ ʙ GASΛ࢖ͬͨSlack΁ͷࣗಈ௨஌ ʙ Google Spreadsheet Google Spreadsheet

    ͱ Slack ͷ࿈ܞ
  14. ࠓ೔ͷຊ୊ ޻਺දॻ͖๨Ε๷ࢭػೳ Λ࡞ͬͯΈͨ ʙ GASΛ࢖ͬͨSlack΁ͷࣗಈ௨஌ ʙ Google Spreadsheet Google Spreadsheet

    ͱ Slack ͷ࿈ܞ ؆୯ʹʂʂ
  15. Google Spreadsheet

  16. ۩ମతͳॲཧ಺༰

  17. ۩ମతͳॲཧ಺༰ ࡢ೔ͷ޻਺Λೖྗ͍ͯ͠Δ͔֬ೝ ೖྗ͞Ε͍ͯΕ͹ɺ Slack΁ʮೖྗͯͯ͑͠Β͍Ͷʂʯͱ௨஌Λ͢Δ ೖྗ͞Ε͍ͯͳ͚Ε͹ Slack΁ʮೖྗͯ͠Ͷʂʯͱ௨஌͢Δɻ

  18. ։ൃͷϙΠϯτ 1. ։ൃ؀ڥ 2. εϓϨουγʔτͷ৘ใΛऔಘ͢Δํ๏ 3. Slack ΁ͷ௨஌ํ๏ 4. ࣗಈͰఆظతͳ޻਺ೖྗνΣοΫɺ

    ɹ௨஌Λ͢Δ࢓૊Έ
  19. ޻਺දॻ͖๨Ε๷ࢭػೳͷ࡞੒ 1. ։ൃ؀ڥ

  20. ޻਺දॻ͖๨Ε๷ࢭػೳͷ࡞੒ 1. ։ൃ؀ڥ Google Spreadsheet ͷΈʂ

  21. ޻਺දॻ͖๨Ε๷ࢭػೳͷ࡞੒ Google Spreadsheet ͷΈʂ 1. ։ൃ؀ڥ

  22. ޻਺දॻ͖๨Ε๷ࢭػೳͷ࡞੒ Google Spreadsheet ͷΈʂ 1. ։ൃ؀ڥ

  23. ޻਺දॻ͖๨Ε๷ࢭػೳͷ࡞੒ Google Spreadsheet ͷΈʂ 1. ։ൃ؀ڥ

  24. ޻਺දॻ͖๨Ε๷ࢭػೳͷ࡞੒ Google Spreadsheet ͷΈʂ ؆୯ʂʂ 1. ։ൃ؀ڥ

  25. ޻਺දॻ͖๨Ε๷ࢭػೳͷ࡞੒ 2. εϓϨουγʔτͷ৘ใΛऔಘ͢Δํ๏

  26. ޻਺දॻ͖๨Ε๷ࢭػೳͷ࡞੒ 2. εϓϨουγʔτͷ৘ใΛऔಘ͢Δํ๏ άάΕ͹ͨ͘͞Μग़ͯ͘Δʂʂ

  27. ޻਺දॻ͖๨Ε๷ࢭػೳͷ࡞੒ 2. εϓϨουγʔτͷ৘ใΛऔಘ͢Δํ๏ SpreadsheetApp.getActiveSheet(); SpreadsheetApp.getActiveSheet().getLastRow(); SpreadsheetApp.getActiveSheet() ɹɹɹɹɹɹ.getRange(i, column, 1).getValue();

  28. ޻਺දॻ͖๨Ε๷ࢭػೳͷ࡞੒ 2. εϓϨουγʔτͷ৘ใΛऔಘ͢Δํ๏ SpreadsheetApp.getActiveSheet(); SpreadsheetApp.getActiveSheet().getLastRow(); SpreadsheetApp.getActiveSheet() ɹɹɹɹɹɹ.getRange(i, column, 1).getValue(); ௚ײతʹ࢖͑Δػೳ͕ἧͬͯΔ

  29. ޻਺දॻ͖๨Ε๷ࢭػೳͷ࡞੒ 2. εϓϨουγʔτͷ৘ใΛऔಘ͢Δํ๏ SpreadsheetApp.getActiveSheet(); SpreadsheetApp.getActiveSheet().getLastRow(); SpreadsheetApp.getActiveSheet() ɹɹɹɹɹɹ.getRange(i, column, 1).getValue(); ௚ײతʹ࢖͑Δػೳ͕ἧͬͯΔ

    ؆୯ʂʂ
  30. ޻਺දॻ͖๨Ε๷ࢭػೳͷ࡞੒ 3. Slack ΁ͷ௨஌

  31. ޻਺දॻ͖๨Ε๷ࢭػೳͷ࡞੒ Incoming Webhook Ҿ༻ݩɿhttps:/ /get.slack.help/hc/ja/ articles/115005265063-Slack- %E3%81%A7%E3%81%AEIncoming-Webhook- %E3%81%AE%E5%88%A9%E7%94%A8 3. Slack

    ΁ͷ௨஌
  32. ޻਺දॻ͖๨Ε๷ࢭػೳͷ࡞੒ Incoming Webhook Ҿ༻ݩɿhttps:/ /get.slack.help/hc/ja/ articles/115005265063-Slack- %E3%81%A7%E3%81%AEIncoming-Webhook- %E3%81%AE%E5%88%A9%E7%94%A8 ϫʔΫεϖʔεʹ ؆୯ʹ֎෦ͷ৘ใΛ

    ڞ༗Ͱ͖Δπʔϧɻ 3. Slack ΁ͷ௨஌
  33. ޻਺දॻ͖๨Ε๷ࢭػೳͷ࡞੒ Incoming Webhook Ҿ༻ݩɿhttps:/ /get.slack.help/hc/ja/ articles/115005265063-Slack- %E3%81%A7%E3%81%AEIncoming-Webhook- %E3%81%AE%E5%88%A9%E7%94%A8 GASͱͷ࿈ܞํ๏͸ɺ άάΕ͹ͨ͘͞Μग़ͯ͘Δʂʂ

    3. Slack ΁ͷ௨஌
  34. ޻਺දॻ͖๨Ε๷ࢭػೳͷ࡞੒ Incoming Webhook Ҿ༻ݩɿhttps:/ /get.slack.help/hc/ja/ articles/115005265063-Slack- %E3%81%A7%E3%81%AEIncoming-Webhook- %E3%81%AE%E5%88%A9%E7%94%A8 3. Slack

    ΁ͷ௨஌ ؆୯ʂʂ GASͱͷ࿈ܞํ๏͸ɺ άάΕ͹ͨ͘͞Μग़ͯ͘Δʂʂ
  35. ޻਺දॻ͖๨Ε๷ࢭػೳͷ࡞੒ 4. ࣗಈ௨஌ʢτϦΨʔʣઃఆ

  36. ޻਺දॻ͖๨Ε๷ࢭػೳͷ࡞੒ 4. ࣗಈ௨஌ઃఆ ʢτϦΨʔʣ

  37. ޻਺දॻ͖๨Ε๷ࢭػೳͷ࡞੒ 4. ࣗಈ௨஌ઃఆ ʢτϦΨʔʣ GUI ͰઃఆͰ͖Δʂ

  38. ޻਺දॻ͖๨Ε๷ࢭػೳͷ࡞੒ 4. ࣗಈ௨஌ʢτϦΨʔʣઃఆ

  39. ޻਺දॻ͖๨Ε๷ࢭػೳͷ࡞੒ 4. ࣗಈ௨஌ʢτϦΨʔʣઃఆ GUI ͰઃఆͰ͖Δʂ ؆୯ʂʂ

  40. ։ൃͷϙΠϯτ 1. ։ൃ؀ڥ 2. εϓϨουγʔτͷ৘ใΛऔಘ͢Δํ๏ 3. Slack ΁ͷ௨஌ํ๏ 4. ࣗಈͰఆظతͳ޻਺ೖྗνΣοΫɺ

    ɹ௨஌Λ͢Δ࢓૊Έ
  41. ։ൃͷϙΠϯτ 1. ։ൃ؀ڥ 2. εϓϨουγʔτͷ৘ใΛऔಘ͢Δํ๏ 3. Slack ΁ͷ௨஌ํ๏ 4. ࣗಈͰఆظతͳ޻਺ೖྗνΣοΫɺ

    ɹ௨஌Λ͢Δ࢓૊Έ ˠ Spreadsheetʹ௚઀͔͚Δ ˠ௚ײతʹ࢖͑Δػೳ͕ἧͬͯΔ ˠSlackΞϓϦͰ؆୯ઃఆ ˠGUI ը໘Ͱ؆୯ઃఆ
  42. ։ൃͷϙΠϯτ 1. ։ൃ؀ڥ 2. εϓϨουγʔτͷ৘ใΛऔಘ͢Δํ๏ 3. Slack ΁ͷ௨஌ํ๏ 4. ࣗಈͰఆظతͳ޻਺ೖྗνΣοΫɺ

    ɹ௨஌Λ͢Δ࢓૊Έ ˠ Spreadsheetʹ௚઀͔͚Δ ˠSlackΞϓϦͰ؆୯ઃఆ ˠGUI ը໘Ͱ؆୯ઃఆ ؆୯ʂʂ ˠ௚ײతʹ࢖͑Δػೳ͕ἧͬͯΔ
  43. ·ͱΊ JavaScript Λ͋·Γॻ͍ͨ͜ͱ͕ͳ͍ਓͰ΋ ʢˢࢲͷ͜ͱʣɺ ؆୯ʹɺ͓खܰʹ։ൃͰ͖ͪΌ͏ʂ Google ΞϓϦؔ࿈ͰԿ͔Λ։ൃ͍ͨ͠ͳΒɺ ͥͻGASΛ࢖ͬͯΈ͍ͯͩ͘͞ʂ

  44. ࠷ޙʹ…

  45. ΋͠SlackͰ௨஌ςετ͢ΔͳΒɺ μΠϨΫτϝοηʔδͰ΍Γ·͠ΐ ͏ɻɻɻ

  46. ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ facebook.com/raichimomo @rachicom_sugar https:/ /rachicom.net/