Skip to main content

Gmail Digest

If you have an assistant (real or AI) working in your inbox, it's helpful to know what they are doing. This tool generates a summary of the emails sent from your inbox each day.

Alternatively, this could be used to monitor a support inbox, sales inbox, etc and understand what is happening across that inbox.

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.

Docker

Check out the docker-compose.yml file for an example of how to run this tool in a docker container.

ghcr.io/iloveitaly/gmail-digest

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

Metadata

Release files for gmail_digest 1.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gmail_digest 1.6.0
File Size Uploaded
gmail_digest-1.6.0.tar.gz 8.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gmail_digest 1.6.0
File Interpreter ABI Platform
gmail_digest-1.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 17.4 kB

Release files / gmail_digest-1.6.0.tar.gz

Download URL gmail_digest-1.6.0.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5129f4c2e900e83bc91ab61bec0c076546df682662f9762c07aa7f75d233010e
BLAKE2b-256 checksum
How to use checksums
ab2409cd95a5db96be26e8b97fecad160fa1bba7c6c925eb4b4f4cce6fef06ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.4 Linux/6.8.0-1020-azure

Release files / gmail_digest-1.6.0-py3-none-any.whl

Download URL gmail_digest-1.6.0-py3-none-any.whl
Size 9.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
56609f13bfe1644ac87f8300374be9f1b213c90143eab3c1ea3236ead7399a25
BLAKE2b-256 checksum
How to use checksums
e07a3e95cbc61c239eca189bb28d83c3c42ceb073184c662d5e6dba34b83bd5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.4 Linux/6.8.0-1020-azure

Release history Release notifications | RSS feed

This release

1.6.0 This release

2 release files

1.5.0

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.6

2 release files

1.2.5

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page