Currently the REPL is read-only (plus batch delete). Adding compose/reply/draft support would make it useful for automation, not just inspection.
Proposed API
// Compose a new message
await send({ to: 'alice@example.com', subject: 'Hello', body: 'Hi there' })
// Reply to an existing message
await reply('1883a5111e8ef47c', 'Thanks!')
// Save a draft
await draft({ to: 'alice@example.com', subject: 'WIP', body: 'Draft body' })
Notes
users.messages.send
users.drafts.create
- Messages need to be RFC 2822 formatted and base64url-encoded before sending
- Reply should set
In-Reply-To and References headers and attach to the correct threadId
- Requires adding
https://www.googleapis.com/auth/gmail.send or https://mail.google.com/ to scopes (the latter is already present)
Currently the REPL is read-only (plus batch delete). Adding compose/reply/draft support would make it useful for automation, not just inspection.
Proposed API
Notes
users.messages.sendusers.drafts.createIn-Reply-ToandReferencesheaders and attach to the correctthreadIdhttps://www.googleapis.com/auth/gmail.sendorhttps://mail.google.com/to scopes (the latter is already present)