A REPL for GMail
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.
./repl.js
await profile()
// List all messages
await messages()
// List all from <email>
await messages('from:[email protected]')
// List unread from <email> sent after <date>
await messages('from:[email protected] is:unread after:2023/05/19')
await message('1883a5111e8ef47c')
// List all threads
await threads()
// List all from <email>
await threads('from:[email protected]')
// List unread from <email> sent after <date>
await threads('from:[email protected] is:unread after:2023/05/19')
await thread('1883b361aaef86b6')
await batchDeleteMessages('category:promotions -is:important -is:starred')
await batchDeleteMessages('before:2021/01/01')