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
790
0
Share
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.1k
MCP Documentation Server @AI Coding Meetup #1
yyoshiki41
2
4k
Go API クライアントの実装 〜Go Conference に載せれなかったTIPS〜
yyoshiki41
0
730
マルチテナントのアプリケーション実装 〜実践編〜
yyoshiki41
5
2.9k
Canary Deployments
yyoshiki41
0
570
Tests API
yyoshiki41
0
69
Graceful Upgrade for Go App
yyoshiki41
0
140
Other Decks in Technology
See All in Technology
ZOZOTOWNリプレイスでのSkills導入までの流れとこれから
zozotech
PRO
4
2.9k
推し活エージェント
yuntan_t
1
860
レガシーシステムをどう次世代に受け継ぐか
tachiiri
0
290
Hooks, Filters & Now Context: Why MCPs Are the “Hooks” of the AI Era
miriamschwab
0
100
仕様通り動くの先へ。Claude Codeで「使える」を検証する
gotalab555
8
2.8k
Databricksを用いたセキュアなデータ基盤構築とAIプロダクトへの応用.pdf
pkshadeck
PRO
0
150
2026-04-02 IBM Bobオンボーディング入門
yutanonaka
0
240
Oracle AI Databaseデータベース・サービス: BaseDB/ExaDB-Dの可用性
oracle4engineer
PRO
1
140
スクラムを支える内部品質の話
iij_pr
0
300
試されDATA SAPPORO [LT]Claude Codeで「ゆっくりデータ分析」
ishikawa_satoru
0
230
建設的な現実逃避のしかた / How to practice constructive escapism
pauli
4
280
AIにより大幅に強化された AWS Transform Customを触ってみる
0air
0
320
Featured
See All Featured
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
350
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.1k
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.8k
Building Flexible Design Systems
yeseniaperezcruz
330
40k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
240
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
390
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.4k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
[SF Ruby Conf 2025] Rails X
palkan
2
920
GraphQLとの向き合い方2022年版
quramy
50
14k
How to make the Groovebox
asonas
2
2.1k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
110
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ʹొ͢ΕຖԼॻ͖࡞ʹ͑·͢ʂ