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
Yoshiki Nakagawa
January 22, 2016
Technology
0
790
go-gmail-drafts
Yoshiki Nakagawa
January 22, 2016
Tweet
Share
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
560
Tests API
yyoshiki41
0
67
Graceful Upgrade for Go App
yyoshiki41
0
130
Other Decks in Technology
See All in Technology
組織のSREを推進するためのPlatform EngineeringとEKS / Platform Engineering and EKS to drive SRE in your organization
chmikata
0
160
【SLO】"多様な期待値" と向き合ってみた
z63d
2
280
All About Sansan – for New Global Engineers
sansan33
PRO
1
1.4k
2026-02-24 月末 Tech Lunch Online #10 Cloud Runのデプロイの課題から考えるアプリとインフラの境界線
masasuzu
0
110
AI が Approve する開発フロー / How AI Reviewers Accelerate Our Development
zaimy
1
250
primeNumber DATA MANAGEMENT CAMP #2:
masatoshi0205
1
650
技術キャッチアップ効率化を実現する記事推薦システムの構築
yudai00
2
160
Data Hubグループ 紹介資料
sansan33
PRO
0
2.8k
作るべきものと向き合う - ecspresso 8年間の開発史から学ぶ技術選定 / 技術選定con findy 2026
fujiwara3
6
1.7k
社内ワークショップで終わらせない 業務改善AIエージェント開発
lycorptech_jp
PRO
1
430
AWS CDK の目玉新機能「Mixins」とは / cdk-mixins
gotok365
2
310
20260222ねこIoTLT ねこIoTLTをふりかえる
poropinai1966
0
320
Featured
See All Featured
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
380
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.4k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
110
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
470
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.1k
Discover your Explorer Soul
emna__ayadi
2
1.1k
Test your architecture with Archunit
thirion
1
2.2k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
220
Typedesign – Prime Four
hannesfritz
42
3k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.1k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4k
Mobile First: as difficult as doing things right
swwweet
225
10k
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ʹొ͢ΕຖԼॻ͖࡞ʹ͑·͢ʂ