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
go-gmail-drafts
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Yoshiki Nakagawa
January 22, 2016
Technology
800
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
go-gmail-drafts
Yoshiki Nakagawa
January 22, 2016
More Decks by Yoshiki Nakagawa
See All by Yoshiki Nakagawa
Amazon Bedrock で作る未来の開発サイクルと オペレーション戦略 / AWS Summit Japan 2025
yyoshiki41
0
1.2k
MCP Documentation Server @AI Coding Meetup #1
yyoshiki41
2
4.1k
Go API クライアントの実装 〜Go Conference に載せれなかったTIPS〜
yyoshiki41
0
750
マルチテナントのアプリケーション実装 〜実践編〜
yyoshiki41
5
3k
Canary Deployments
yyoshiki41
0
580
Tests API
yyoshiki41
0
72
Graceful Upgrade for Go App
yyoshiki41
0
140
Other Decks in Technology
See All in Technology
インシデントレスポンス演習 I / Incident Response Exercise I
ks91
PRO
0
100
サイバーエージェントにおけるAI推進戦略と変革への取り組み
shotatsuge
0
150
徹底討論!ECS vs EKS!
daitak
1
640
【NRUG vol.18】KubernetesにおけるNew Relicデータ取得量削減の考え方
nrug_member
0
170
小さく始める AI 活用推進 ― 日経電子版 Web チームの事例/nikkei-tech-talk47
nikkei_engineer_recruiting
0
300
Flow 不死:AI 時代 DevOps 的不變本質
cheng_wei_chen
2
340
入門!AWS Blocks
ysuzuki
1
160
不要なレビューをAIにまかせて AIコーディングの環境改善を加速した
shoota
1
230
コミュニティの有益性 ~JAWS Days 2026 での体験を通して~ / The Benefits of a Community ~Through My Experience at JAWS Days 2026~
seike460
PRO
0
190
10年間のブログ発信を振り返って見えたWebアプリケーションエンジニアとしての軌跡
stefafafan
0
170
あなたの知らないPDFのアクセシビリティ
lycorptech_jp
PRO
0
220
2026 TECHFRESH 畢業分享會 - AI-Native 重塑軟體工程與虛擬講師
line_developers_tw
PRO
0
1.3k
Featured
See All Featured
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
400
The untapped power of vector embeddings
frankvandijk
2
1.8k
A Tale of Four Properties
chriscoyier
163
24k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6k
Code Review Best Practice
trishagee
74
20k
How GitHub (no longer) Works
holman
316
150k
Darren the Foodie - Storyboard
khoart
PRO
3
3.4k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
430
Being A Developer After 40
akosma
91
590k
The Curse of the Amulet
leimatthew05
1
13k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
970
Transcript
ΦʔϓϯιʔεϥΠϒϥϦݚڀձ #3 Jan / 22 / 2016 Yoshiki Nakagawa eureka,
Inc.
AboutMe @yyoshiki41 Yoshiki Nakagawa Infrastructure Engineer, pairs Division Tech •
Golang • Middleware, RDBMS • AWS
Google APIs Client Library for Go GitHub : https://github.com/google/google-api-go-client/ Enable
to access google APIs - Gmail API - BigQuery API - Calendar API etc...
yyoshiki41/go-gmail-drafts GitHub : https://github.com/yyoshiki41/go-gmail-drafts Create a new draft using the
Gmail API.
Why not Google Apps Script ? Apps Script is not
enough... Can't create drafts. (only get drafts) So use Google APIs Client Library ! Other languages libraries : https://developers.google.com/discovery/libraries All Libraries are open-sourced !
Preparation ̍. Google Developer Console ͔Βɺ৽نϓϩδΣΫτΛ࡞ ͢Δɻ ̎. ϓϩδΣΫτͷ Gmail
API Λ༗ޮʹ͢Δɻ
̏. ೝূใΛઃఆ͢Δɻ ̐. ඞཁͳೝূใΛΫϦοΫɻ
̑. OAuth ΫϥΠΞϯτͷઃఆɻ OAuthೝূΛྃͤ͞ɺJSONϑΝΠϧΛμϯϩʔυ͠·͢ɻ ޙͰ͍·͢ʂ
How to ̍. go get $ go get github.com/yyoshiki41/go-gmail-drafts $
cd $GOPATH/src/github.com/yyoshiki41/go-gmail-drafts ̎. μϯϩʔυͨ͠jsonϑΝΠϧΛઃஔɻ $ mv ~/Downloads/clientid.json config/clientsecret.json
̏. ॳճ࣮ߦ࣌OAuth௨͠ɺΞΫηετʔΫϯΛऔಘ͢Δɻ $ go run savetoken/main.go ϒϥβ͕ࣗಈͰ։͖ɺgoogleΞΧϯτͷೝূΛ͠·͢ɻ ࣍ʹɺGmailͰͷΞΫγϣϯΛڐՄ͠·͢ɻ
̑ɽςΩετϘοΫεʹදࣔ͞ΕͨcodeΛίϐʔ͢Δɻ λʔϛφϧʹͬͯɺtokenϑΝΠϧΛੜɻ ίϐʔͨ͠ίʔυΛషΓ͚Δɻ
̑. Լॻ͖ςϯϓϨΛ࡞ɻ { "to": "
[email protected]
", "subject": "Daily Reports", "message": "Hello!\nThis
is a draft." }
̒. go runͰ࣮ߦɻ $ go run main.go
ऴΘΓʹ go buildͰόΠφϦԽͯ͠ɺ cronʹొ͢ΕຖԼॻ͖࡞ʹ͑·͢ʂ