Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
LINE Notifyで作る健康習慣をサポートする仕組み
Search
tadaken3
December 06, 2019
Programming
2.6k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
LINE Notifyで作る健康習慣をサポートする仕組み
tadaken3
December 06, 2019
Transcript
20 slides
Google Apps Scriptで 三日坊主を克服する -エンジニア健康サミット 2019- @tadaken3
自己紹介 • タダケン(@tadaken3) • 京都出身 • ピープルアナリスト (LINE 人事 ←
LINE ゲーム事業部 ← 任天堂) • 趣味:自転車、ポケモンGo 愛車のブロンプトン
筋トレしてますか?
筋トレしたいですよね?
せっかくジム通いを始めたけど、 • 仕事が忙しくて • 今日、雨だから • 飲み会に誘われた • やる気が出ない あるある
Google Apps Scriptで三日坊主を克服する 観測さえできれば干渉できる。 干渉できるなら、制御もできる。
①行動の記録 ④送信指示 ③計算結果の 保存 ②経過日数の 計算 スプレッドシート スマートフォン Google Apps
Scriptで三日坊主を克服する Google Apps Script LINE Notify API
Google Apps Scriptで三日坊主を克服する IFTTTでボタンを作る
Google Apps Scriptで三日坊主を克服する スプレッドシートに記録
Google Apps Scriptで三日坊主を克服する //IFTTTの日付形式から通常の日付に変換 function toDateFromIFTTT(str){ str = String(str); str
= str.replace(/at.*/,"")//正規表現でatより後ろの部分を削除 d = new Date(str); return d; } IFTTTの日付形式(str)をdateに変換
Google Apps Scriptで三日坊主を克服する var ss = SpreadsheetApp.getActiveSpreadsheet(); //スプレッドシートを取得 var sheet
= ss.getSheetByName("log"); //シートを取得 //シートの最終行に経過日を計算する式をセットする function setFormuraLastRow(){ //シートの使用範囲のうち最終行を取得 var maxRow = sheet.getDataRange().getLastRow(); //A列の最終行の値を取得 var str = sheet.getRange(maxRow,1).getValue(); //スプレッドシート用の式 var code = '=TODAY() - TO_DATE(B'+ maxRow+')'; //フォーマットした日付をセット sheet.getRange(maxRow,2).setValue(toDateFromIFTTT(str)); //式をセットする sheet.getRange(maxRow,3).setFormula(code); } 経過日数を計算する
Google Apps Scriptで三日坊主を克服する 経過日数が計算できた
Google Apps Scriptで三日坊主を克服する //LINEに通知を送る関数 function sentToLine(message){ var token = "先程取得したアクセストークン";
var options = { "method" : "post", "payload" : "message=" + message, "headers" : {"Authorization" : "Bearer "+ token} }; UrlFetchApp.fetch("https://notify-api.line.me/api/notify",options); } LINE Notifyにメッセージを送る
Google Apps Scriptで三日坊主を克服する function main(){ setFormuraLastRow() var maxRow = sheet.getDataRange().getLastRow();
var passDate = sheet.getRange(maxRow,3).getValue(); var message =""; //経過日が3日もしくは7日以上だったらLINEに通知を送る if (passDate==3 || passDate>=7){ message = "最終トレーニングから"+ passDate + "日経過しました"; sentToLine(message); } } 組わせて実装する
まとめ • IFTTTを使ってシートに行動を記録 • GASで経過日数を計算と送信判定 • LINE Notifyで通知 Google Apps
Scriptで三日坊主を克服する
他にも Fitbit APIと組わせて摂取カロリーと栄養素を通知 あなただけのパーソナルトレーナーが作れる
それでもジムに行けないあなたに • 健康のために「歩くこと」が非常に大切 • 一日10000歩以上が理想的 (最低でも5000歩以上はほしい) • 歩数を増やすと健康だけでなく 脳の機能もアップするという実験結果も
参考:https://www.ncbi.nlm.nih.gov/pubmed/20890449
お気に入りの健康アイテム
– tadaken3 “ポケモンGoのフレンド募集中”
ご清聴ありがとうございました
More Decks by tadaken3
See All by tadaken3
Exploratoryサーバーで構築した 戦略と実行を繋ぐSSoT分析環境
tadaken3
0
38
kubell 2025 エンジニアサマーインターンシップ
tadaken3
0
180
戦略と実行を繋ぐ活用ファーストのデータ分析基盤
tadaken3
0
100
プロダクト活用度で見えた真実 ホリゾンタルSaaSでの顧客解像度の高め方
tadaken3
0
1.4k
Exploratory:プロダクト活用度の話
tadaken3
0
100
[我が社のデータエンジニアリング現場]我が社が考える最強のデータ基盤・開発体制!
tadaken3
0
170
はじめてのWatchOSアプリ。はじめてのiOSアプリ
tadaken3
0
98
拡張現実を活用して幸福度をあげる方法
tadaken3
0
2.3k
チームづくりにおける成功法則 - LINEにおけるHR Techの取り組み- / people analytics tokyo
tadaken3
1
7.1k
Other Decks in Programming
See All in Programming
AI-Powered Domain-Driven Design
ziobrando
0
460
[Kotlin Fest 2026] eBPF Tracing for Kotlin
takehaya
1
270
Enforcing Your Architecture with Unit Tests in the AI Era (Swift Connection X)
steliosf
PRO
1
180
Seven New Principles of Software Engineering
yegor256
0
500
Snowflake Openflow Connector利用の勘所 / 20261024developersio2026tokyo-snowflake-openflow
kasacchiful
PRO
0
340
クラウドゲーミングのパフォーマンス最適化に挑む / Cloud Gaming Performance Tuning
vivion
0
350
SODA - FACT BOOK(JP)
sodainc
1
40k
Scalaの型でマルチテナントの認可を守る
nextbeatdev
0
150
プロジェクトコードをキレイキレイしよう!暗黙的な参照を読み解く静的解析
ostk0069
0
220
地方こそサーバーレス — 10年続けた、顔が見えるチームで確かな基盤を / Serverless Matters Most in Regional Areas — 10 Years of Building Reliable Foundations with Close-Knit Teams
seike460
PRO
1
470
仕様駆動開発入門 (何を作るかを先に決めて渡す) | 目指せ Kiro マスター 05
inariku
PRO
2
170
まずはコードより業務と向き合う:テーブル解体のためにPdMを呼んだ話
sakawe_ee
0
240
Featured
See All Featured
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.8k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
12k
Skip the Path - Find Your Career Trail
mkilby
1
290
SEO for Brand Visibility & Recognition
aleyda
0
4.9k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
660
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2.2k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
880
Leo the Paperboy
mayatellez
11
2.5k
Intergalactic Javascript Robots from Outer Space
tanoku
273
28k
Building Applications with DynamoDB
mza
96
7.3k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
2
520
Speed Design
sergeychernyshev
33
2.2k