swinton / gmail-repl

A REPL for GMail

Home Page:https://github.com/swinton/gmail-repl

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

🔁 gmail-repl

A REPL for GMail

Setup

Follow the Node.js quickstart from the Gmail for Developers guide, and make sure your desktop application credentials are stored in a credentials.json file -- see credentials-example.json for an example.

Usage

./repl.js

Examples

Get profile

users.getProfile

await profile()

List messages

users.messages.list

// List all messages
await messages()

// List all from <email>
await messages('from:me@example.com')

// List unread from <email> sent after <date>
await messages('from:me@example.com is:unread after:2023/05/19')

Read a message

users.messages.get

await message('1883a5111e8ef47c')

List threads

users.threads.list

// List all threads
await threads()

// List all from <email>
await threads('from:me@example.com')

// List unread from <email> sent after <date>
await threads('from:me@example.com is:unread after:2023/05/19')

Read a thread

users.threads.get

await thread('1883b361aaef86b6')

Batch delete

users.messages.batchDelete

Batch delete unimportant promotional messages

await batchDeleteMessages('category:promotions -is:important -is:starred')

Batch delete messages from before 2021

await batchDeleteMessages('before:2021/01/01')

About

A REPL for GMail

https://github.com/swinton/gmail-repl

License:ISC License


Languages

Language:JavaScript 100.0%