{"id":29152830,"url":"https://github.com/jarif87/daily-email-report","last_synced_at":"2026-04-27T17:33:31.034Z","repository":{"id":298578081,"uuid":"1000441643","full_name":"jarif87/daily-email-report","owner":"jarif87","description":"Python tool that automates daily email summaries (12:01 AM–9:01 AM BDT) using Grok AI, updates Google Sheets, and sends Slack notifications.","archived":false,"fork":false,"pushed_at":"2025-06-11T19:43:40.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-11T21:27:05.699Z","etag":null,"topics":["ai-agents","email","groq-api","python","slack"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jarif87.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-11T19:38:37.000Z","updated_at":"2025-06-11T19:43:43.000Z","dependencies_parsed_at":"2025-06-11T21:27:37.476Z","dependency_job_id":"ef74d95f-5d20-44d6-885a-d12c0320e6e5","html_url":"https://github.com/jarif87/daily-email-report","commit_stats":null,"previous_names":["jarif87/daily-email-report"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jarif87/daily-email-report","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jarif87%2Fdaily-email-report","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jarif87%2Fdaily-email-report/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jarif87%2Fdaily-email-report/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jarif87%2Fdaily-email-report/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jarif87","download_url":"https://codeload.github.com/jarif87/daily-email-report/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jarif87%2Fdaily-email-report/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262876868,"owners_count":23378139,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-agents","email","groq-api","python","slack"],"created_at":"2025-07-01T01:03:11.618Z","updated_at":"2026-04-27T17:33:26.012Z","avatar_url":"https://github.com/jarif87.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Daily Email Report Automation\r\n\r\nThe **Daily Email Report Automation** is a Python-based tool that automates the process of fetching, summarizing, and reporting emails received between 12:01 AM and 9:01 AM BDT daily. It integrates Gmail, Google Sheets, and Slack APIs, using Grok AI to summarize email content. Summaries are stored in a Google Sheet and sent as a notification to a Slack channel, streamlining daily communication monitoring.\r\n\r\n## Table of Contents\r\n- [Purpose](#purpose)\r\n- [Features](#features)\r\n- [Installation](#installation)\r\n- [Usage](#usage)\r\n- [Project Structure](#project-structure)\r\n- [Dependencies](#dependencies)\r\n- [Setup Requirements](#setup-requirements)\r\n- [Logging](#logging)\r\n- [Contributing](#contributing)\r\n- [License](#license)\r\n- [Contact](#contact)\r\n\r\n## Purpose\r\nThe **Daily Email Report Automation** simplifies the task of reviewing and summarizing emails received overnight (12:01 AM to 9:01 AM BDT). It fetches emails from Gmail, generates concise summaries using Grok AI, updates a Google Sheet with the results, and sends a notification to a Slack channel. This tool is ideal for teams or individuals who need a daily digest of important emails without manual effort.\r\n\r\n### Why Use This Project?\r\n- **Automation**: Saves time by automatically fetching and summarizing emails.\r\n- **AI Summaries**: Uses Grok AI to create concise, readable email summaries.\r\n- **Multi-Platform Integration**: Connects Gmail, Google Sheets, and Slack for a seamless workflow.\r\n- **Reliability**: Includes error handling and logging for robust operation.\r\n- **Convenience**: Provides a batch script (`run_daily_report.bat`) for easy execution on Windows.\r\n\r\n## Features\r\n- **Email Fetching**: Retrieves emails from Gmail received between 12:01 AM and 9:01 AM BDT, excluding spam and trash.\r\n- **AI-Powered Summaries**: Uses Grok AI to summarize email content into 1-2 sentences (max 130 words).\r\n- **Google Sheets Integration**: Clears and updates a specified Google Sheet range with email subjects and summaries.\r\n- **Slack Notifications**: Sends a daily report to a Slack channel with up to 5 email summaries and a total count.\r\n- **Timezone Awareness**: Handles Bangladesh Time (BDT, UTC+6) for precise email filtering.\r\n- **Logging**: Outputs detailed logs to `log.txt` and the console for debugging and monitoring.\r\n\r\n## Installation\r\nFollow these steps to set up the project locally:\r\n\r\n1. **Clone the Repository**:\r\n   ```\r\n   git clone https://github.com/username/daily-email-report.git\r\n   cd daily-email-report\r\n   ```\r\n2. **Set Up a Virtual Environment (recommended):**\r\n\r\n```\r\npython -m venv venv\r\nsource venv/bin/activate  # On Windows: venv\\Scripts\\activate\r\n```\r\n3. **Install Dependencies:**\r\n```\r\npip install -r requirements.txt\r\n\r\n```\r\n4. **Set Up Environment Variables:**\r\n\r\n- **Create a .env file in the root directory with:**\r\n```\r\n\r\nSLACK_BOT_TOKEN=your_slack_bot_token\r\nGROQ_API_KEY=your_groq_api_key\r\n\r\n```\r\n* Obtain a Slack Bot Token from your Slack workspace (create a bot with chat:write scope).\r\n\r\n* Get a Grok API key from xAI.\r\n\r\n## Set Up Google API Credentials:\r\n- Download credentials.json from the Google Cloud Console for a Desktop app with Gmail and Google Sheets APIs enabled.\r\n- Place credentials.json in the project root.\r\n- Ensure the following scopes are enabled:\r\n  - https://www.googleapis.com/auth/gmail.readonly\r\n  - https://www.googleapis.com/auth/spreadsheets\r\n\r\n## Configure Google Sheet:\r\n- Create a Google Sheet and note its Spreadsheet ID (found in the URL: https://docs.google.com/spreadsheets/d/SPREADSHEET_ID/edit).\r\n- Update the SPREADSHEET_ID in main.py if different from the default (1QQ8bZUodwLTs_lc8Vxry_EoPIhdGb8kaHtQN19ScfAc).\r\n- Ensure the Sheet has a tab named Sheet1 (or update SHEET_RANGE in main.py).\r\n\r\n## Run the Application:\r\n- On Windows, double-click run_daily_report.bat or run:\r\n```\r\n.\\run_daily_report.bat\r\n```\r\n- On Linux/Mac, run:\r\n```\r\npython main.py\r\n```\r\n\r\n# Usage\r\n##### Run the Script:\r\n- Execute run_daily_report.bat (Windows) or python main.py (Linux/Mac).\r\n- On first run, authenticate with Google via a browser prompt to grant access to Gmail and Sheets APIs.\r\n##### What It Does:\r\n- Fetches emails received between 12:01 AM and 9:01 AM BDT.\r\n- Summarizes email content using Grok AI.\r\n- Updates a Google Sheet (Sheet1!A:B) with email subjects and summaries.\r\n- Sends a Slack notification to the #mydaily-report channel with up to 5 summaries and the total email count.\r\n##### Monitor Output:\r\n- Check log.txt for detailed logs of email fetching, summarization, Sheet updates, and Slack notifications.\r\n- Console output provides real-time feedback on the process.\r\n##### Scheduling:\r\n- Schedule the script to run daily (e.g., via Windows Task Scheduler or a cron job) to automate daily reporting.\r\n\r\n# Project Structure\r\n\r\n```\r\ndaily-email-report/\r\n├── app.py                   # Main script for email fetching, summarization, and reporting\r\n├── credentials.json          # Google API credentials (not tracked in Git)\r\n├── token.json                # Google API token (generated after authentication, not tracked)\r\n├── log.txt                   # Log file for debugging and monitoring\r\n├── run_daily_report.bat      # Batch script for running the agent on Windows\r\n├── .env                      # Environment variables (API keys)\r\n├── requirements.txt          # Project dependencies\r\n└── README.md                 # Project documentation\r\n```\r\n\r\n## Dependencies\r\n\r\n```\r\ngoogle-auth-oauthlib\r\ngoogle-api-python-client\r\nslack-sdk\r\ngroq\r\npython-dotenv\r\npytz\r\n```\r\n```\r\npip install google-auth-oauthlib google-api-python-client slack-sdk groq python-dotenv pytz\r\n```\r\n\r\n# Setup Requirements\r\n- Google Cloud Project: Enable Gmail and Google Sheets APIs, and download credentials.json for a Desktop app.\r\n- Grok API Key: Obtain from xAI for email summarization.\r\n- Slack Workspace: Create a bot with chat:write scope and add it to the #mydaily-report channel.\r\n- Google Sheet: A Sheet with a Sheet1 tab and the correct Spreadsheet ID.\r\n- Python 3.8+: Ensure Python is installed.\r\n- Internet Connection: Required for API calls.\r\n\r\n## Logging\r\n- All actions and errors are logged to log.txt and the console.\r\n\r\n### Logs include:\r\n- Google authentication status\r\n- Email fetching and summarization details\r\n- Google Sheet updates\r\n- Slack notification status\r\n- Error messages with troubleshooting tips\r\n\r\n### Notes on Project Files\r\n- **credentials.json**: Not tracked in Git; users must download it from Google Cloud Console.\r\n- **token.json**: Generated after Google authentication; not tracked to avoid exposing sensitive data.\r\n- **log.txt**: Stores logs (replaces `print` statements for file-based logging in a production setup).\r\n- **run_daily_report.bat**: A batch file for Windows users to run the script easily (assumed to contain `python main.py`).\r\n- **.env**: Stores sensitive API keys, not tracked in Git.\r\n- **requirements.txt**: Lists all dependencies for easy installation.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjarif87%2Fdaily-email-report","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjarif87%2Fdaily-email-report","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjarif87%2Fdaily-email-report/lists"}