Skip to main content

A tool to generate a daily digest of your Gmail inbox. Helpful if you have agents working on your behalf.

Project description

Gmail Digest

Installation

pip install -U gmail-digest

Usage

Usage: gmail-digest [OPTIONS]

Options:
  --dry-run  Run script without creating sending
  --help     Show this message and exit.

Extra filter

You can customize the gmail query used to collect emails to summarize:

GMAIL_FILTER_SUFFIX='-to:personal@gmail.com -to:readwise.io -to:todoist.com'

Development

Test the tool by running it locally and increasing DIGEST_DAYS.

Need to debug OpenAI/prompt issues? Enable debug logging.

Setup

You need to create a "OAuth 2.0 Client IDs" which has to be done with a Google Workspace (gsuite). This will not work on a personal gmail account (unless you create a app on a workspace and add your personal account as a test account).

Generating a Gmail API Token

  1. Navigate to the Google Cloud Console. https://console.developers.google.com/
  2. Create a new project or select an existing one.
  3. Go to "APIs & Services" -> "Library" and enable the Gmail API.
  4. Navigate to "APIs & Services" -> "Credentials".
  5. Click "Create Credentials" -> "OAuth client ID".
  6. Select "Desktop app" as the application type, then click "Create".
  7. Download the JSON file, rename it to credentials.json, and place it in the root of this project.
  8. Run the script and oauth into your account

If you want to edit scopes on an existing application, you can:

  1. OAuth Consent Screen
  2. Edit
  3. Continue to step 2
  4. Add or remove scopes
  5. Add scopes and save

Credential Scopes Needed

Two main scopes are required for this:

  • https://www.googleapis.com/auth/gmail.compose
  • https://www.googleapis.com/auth/gmail.readonly

Some other scopes I'd add so you can reuse the credentials in other projects, like gmailctl or calendar scripts:

  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.googleapis.com/auth/calendar.event
  • https://www.googleapis.com/auth/gmail.labels
  • https://www.googleapis.com/auth/gmail.settings.basic

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gmail_digest-1.5.0.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gmail_digest-1.5.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file gmail_digest-1.5.0.tar.gz.

File metadata

  • Download URL: gmail_digest-1.5.0.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Linux/6.8.0-1020-azure

File hashes

Hashes for gmail_digest-1.5.0.tar.gz
Algorithm Hash digest
SHA256 f587a3a39d530643ab5abf90465201f9459811248503c56752b00a6e97470ed0
MD5 202c0301c7cc4cebaddc336b522bedd3
BLAKE2b-256 7fb04d34f3a958ae8f562d62ed8d5df43058c7f330083910ddfaeb634c9b6225

See more details on using hashes here.

File details

Details for the file gmail_digest-1.5.0-py3-none-any.whl.

File metadata

  • Download URL: gmail_digest-1.5.0-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Linux/6.8.0-1020-azure

File hashes

Hashes for gmail_digest-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6558c578f5e30ffafe71bc74844837e2e10d8b240e7fda1110b003881e43d89d
MD5 e040a96a0731e5e8fad0039c229ed348
BLAKE2b-256 7f5884d0d638759ebb15e4113c6b155feaa0b11f05983e58dda14eaa0a0286e0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page