gmail_digest


Namegmail_digest JSON
Version 1.6.0 PyPI version JSON
download
home_pagehttps://github.com/iloveitaly/gmail-digest
SummaryA tool to generate a daily digest of your Gmail inbox. Helpful if you have agents working on your behalf.
upload_time2025-01-27 14:31:55
maintainerNone
docs_urlNone
authorMichael Bianco
requires_python<4.0,>=3.9
licenseMIT
keywords gmail email gmail-api llm ai digest
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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

```shell
pip install -U gmail-digest
```

## Usage

```shell
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](./docker-compose.yml) 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:

```shell
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.](https://stackoverflow.com/questions/76256249/logging-in-the-open-ai-python-library/78214464#78214464)

## 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](https://github.com/mbrt/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`

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/iloveitaly/gmail-digest",
    "name": "gmail_digest",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": "gmail, email, gmail-api, llm, ai, digest",
    "author": "Michael Bianco",
    "author_email": "mike@mikebian.co",
    "download_url": "https://files.pythonhosted.org/packages/ab/24/09cd95a5db96be26e8b97fecad160fa1bba7c6c925eb4b4f4cce6fef06ea/gmail_digest-1.6.0.tar.gz",
    "platform": null,
    "description": "# Gmail Digest\n\nIf 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.\n\nAlternatively, this could be used to monitor a support inbox, sales inbox, etc and understand what is happening across that inbox.\n\n## Installation\n\n```shell\npip install -U gmail-digest\n```\n\n## Usage\n\n```shell\nUsage: gmail-digest [OPTIONS]\n\nOptions:\n  --dry-run  Run script without creating sending\n  --help     Show this message and exit.\n```\n\n### Docker\n\nCheck out the [docker-compose.yml file](./docker-compose.yml) for an example of how to run this tool in a docker container.\n\n```\nghcr.io/iloveitaly/gmail-digest\n```\n\n### Extra filter\n\nYou can customize the gmail query used to collect emails to summarize:\n\n```shell\nGMAIL_FILTER_SUFFIX='-to:personal@gmail.com -to:readwise.io -to:todoist.com'\n```\n\n## Development\n\nTest the tool by running it locally and increasing `DIGEST_DAYS`.\n\nNeed to debug OpenAI/prompt issues? [Enable debug logging.](https://stackoverflow.com/questions/76256249/logging-in-the-open-ai-python-library/78214464#78214464)\n\n## Setup\n\nYou 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).\n\n### Generating a Gmail API Token\n\n1. Navigate to the Google Cloud Console. https://console.developers.google.com/\n2. Create a new project or select an existing one.\n3. Go to \"APIs & Services\" -> \"Library\" and enable the Gmail API.\n4. Navigate to \"APIs & Services\" -> \"Credentials\".\n5. Click \"Create Credentials\" -> \"OAuth client ID\".\n6. Select \"Desktop app\" as the application type, then click \"Create\".\n7. Download the JSON file, rename it to `credentials.json`, and place it in the root of this project.\n8. Run the script and oauth into your account\n\nIf you want to edit scopes on an existing application, you can:\n\n1. OAuth Consent Screen\n2. Edit\n3. Continue to step 2\n4. Add or remove scopes\n5. Add scopes and save\n\n#### Credential Scopes Needed\n\nTwo main scopes are required for this:\n\n* `https://www.googleapis.com/auth/gmail.compose`\n* `https://www.googleapis.com/auth/gmail.readonly`\n\nSome other scopes I'd add so you can reuse the credentials in other projects, [like gmailctl](https://github.com/mbrt/gmailctl) or calendar scripts:\n\n* `https://www.googleapis.com/auth/calendar.readonly`\n* `https://www.googleapis.com/auth/calendar.event`\n* `https://www.googleapis.com/auth/gmail.labels`\n* `https://www.googleapis.com/auth/gmail.settings.basic`\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A tool to generate a daily digest of your Gmail inbox. Helpful if you have agents working on your behalf.",
    "version": "1.6.0",
    "project_urls": {
        "Homepage": "https://github.com/iloveitaly/gmail-digest"
    },
    "split_keywords": [
        "gmail",
        " email",
        " gmail-api",
        " llm",
        " ai",
        " digest"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e07a3e95cbc61c239eca189bb28d83c3c42ceb073184c662d5e6dba34b83bd5b",
                "md5": "4eb7ea0b795ceb7c5e4f1f5138e813fb",
                "sha256": "56609f13bfe1644ac87f8300374be9f1b213c90143eab3c1ea3236ead7399a25"
            },
            "downloads": -1,
            "filename": "gmail_digest-1.6.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4eb7ea0b795ceb7c5e4f1f5138e813fb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 9194,
            "upload_time": "2025-01-27T14:31:54",
            "upload_time_iso_8601": "2025-01-27T14:31:54.557006Z",
            "url": "https://files.pythonhosted.org/packages/e0/7a/3e95cbc61c239eca189bb28d83c3c42ceb073184c662d5e6dba34b83bd5b/gmail_digest-1.6.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ab2409cd95a5db96be26e8b97fecad160fa1bba7c6c925eb4b4f4cce6fef06ea",
                "md5": "f0f054f74b51709dc980f4807877e409",
                "sha256": "5129f4c2e900e83bc91ab61bec0c076546df682662f9762c07aa7f75d233010e"
            },
            "downloads": -1,
            "filename": "gmail_digest-1.6.0.tar.gz",
            "has_sig": false,
            "md5_digest": "f0f054f74b51709dc980f4807877e409",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 8217,
            "upload_time": "2025-01-27T14:31:55",
            "upload_time_iso_8601": "2025-01-27T14:31:55.479414Z",
            "url": "https://files.pythonhosted.org/packages/ab/24/09cd95a5db96be26e8b97fecad160fa1bba7c6c925eb4b4f4cce6fef06ea/gmail_digest-1.6.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-27 14:31:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "iloveitaly",
    "github_project": "gmail-digest",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "gmail_digest"
}
        
Elapsed time: 2.11520s