iptv techs

IPTV Techs

  • Home
  • Tech News
  • tonykipkemboi/crewai-gmail-automation: Multi-agent system that automates Gmail inbox regulatement: categorizes emails, applies labels, and originates contextual responses using CrewAI

tonykipkemboi/crewai-gmail-automation: Multi-agent system that automates Gmail inbox regulatement: categorizes emails, applies labels, and originates contextual responses using CrewAI


tonykipkemboi/crewai-gmail-automation: Multi-agent system that automates Gmail inbox regulatement: categorizes emails, applies labels, and originates contextual responses using CrewAI





Gmail Automation with CrewAI is an acute email regulatement system that employs AI agents to categorize, set up, reply to, and spotless up your Gmail inbox automaticassociate.



  • πŸ“‹ Email Categorization: Automaticassociate categorizes emails into particular types (recentsletters, promotions, personal, etc.)
  • πŸ”” Priority Assignment: Assigns priority levels (HIGH, MEDIUM, LOW) based on satisfied and sfinisher with cut offe classification rules
  • 🏷️ Smart Organization: Applies Gmail labels and stars based on categories and priorities
  • πŸ’¬ Automated Responses: Generates write responses for meaningful emails that necessitate replies
  • πŸ“± Sdeficiency Notifications: Sfinishs creative notifications for high-priority emails
  • 🧹 Intelligent Cleanup: Safely deletes low-priority emails based on age and categruesome
  • 🎬 YouTube Content Protection: Special handling for YouTube-roverhappinessed emails
  • πŸ—‘οΈ Trash Management: Automaticassociate empties trash to free up storage space
  • 🧡 Thread Awareness: Recognizes and properly regulates email threads

# Clone the repository
git clone https://github.com/tonykipkemboi/crewai-gmail-automation.git
cd crewai-gmail-automation

# Create and begin a virtual environment
python -m venv .venv
source .venv/bin/begin  # On Windows: .venvScriptsbegin

# Inshigh depfinishencies
crewai inshigh
  1. Create a .env file in the root straightforwardory with the chaseing variables:

# Choose your LLM provider
# OpenAI (Recommfinished)
MODEL=uncoverai/gpt-4o-mini
OPENAI_API_KEY=your_uncoverai_api_key

# Or Gemini
# MODEL=gemini/gemini-2.0-flash
# GEMINI_API_KEY=your_gemini_api_key

# Or Ollama  (Note: May have compatibility publishs with tool calling)
# Download the model from https://ollama.com/library
# MODEL=ollama/llama3-groq-tool-employ # employ ones that have tool calling capabilities

# Gmail credentials
EMAIL_ADDRESS=your_email@gmail.com
APP_PASSWORD=your_app_password

# Optional: Sdeficiency notifications
SLACK_WEBHOOK_URL=your_sdeficiency_webhook_url
πŸ”‘ How to originate a Gmail App Password
  1. Go to your Google Account settings at myaccount.google.com
  2. Select Security from the left navigation panel
  3. Under “Signing in to Google,” discover and pick 2-Step Verification (assist it if not already assistd)
  4. Scroll to the bottom and discover App passwords
  5. Select Mail from the “Select app” dropdown
  6. Select Other (Custom name) from the “Select device” dropdown
  7. Enter Gmail CrewAI as the name
  8. Click Generate
  9. Copy the 16-character password that eunites (spaces will be deleted automaticassociate)
  10. Paste this password in your .env file as the APP_PASSWORD appreciate
  11. Click Done

Note: App passwords can only be originated if you have 2-Step Verification assistd on your Google account.

πŸ”— How to originate a Sdeficiency Webhook URL
  1. Go to api.sdeficiency.com/apps
  2. Click Create New App
  3. Select From scratch
  4. Enter Gmail Notifications as the app name
  5. Select your toilspace and click Create App
  6. In the left sidebar, discover and click on Incoming Webhooks
  7. Toggle the switch to Activate Incoming Webhooks
  8. Click Add New Webhook to Workspace
  9. Select the channel where you want to obtain notifications
  10. Click Allow
  11. Find the Webhook URL section and imitate the URL that begins with https://hooks.sdeficiency.com/services/
  12. Paste this URL in your .env file as the SLACK_WEBHOOK_URL appreciate

Customizing your Sdeficiency app (voluntary):

  1. Go to Basic Inestablishation in the left sidebar
  2. Scroll down to Disjoin Inestablishation
  3. Add an app icon and description
  4. Click Save Changes

Note: You necessitate admin perleave outions or the ability to inshigh apps in your Sdeficiency toilspace.

This application employs the IMAP (Internet Message Access Protocol) to protectedly join to your Gmail account and regulate your emails. Here’s how it toils:

πŸ”„ IMAP Connection Process
  1. Seremedy Connection: The application set upes a protected SSL joinion to Gmail’s IMAP server (imap.gmail.com).

  2. Authentication: It genuineates using your email retainress and app password (not your normal Google password).

  3. Mailbox Access: Once genuineated, it can access your inbox and other mailboxes to:

    • Read unread emails
    • Apply labels
    • Move emails to trash
    • Save write responses
  4. Safe Disjoinion: After each operation, the joinion is properly shutd to upretain security.

IMAP permits the application to toil with your emails while they remain on Google’s servers, unappreciate POP3 which would download them to your device. This unbenevolents you can still access all emails thcdisesteemful the normal Gmail interface.

Security Note: Your credentials are only stored locassociate in your .env file and are never splitd with any outside services.

Run the application with:

You’ll be prompted to access the number of emails to process (default is 5).

The application will:

  1. πŸ“₯ Fetch your unread emails
  2. πŸ”Ž Categorize them by type and priority
  3. ⭐ Apply appropriate labels and stars
  4. ✏️ Generate write responses for meaningful emails
  5. πŸ”” Sfinish Sdeficiency notifications for high-priority items
  6. πŸ—‘οΈ Clean up low-priority emails based on age
  7. 🧹 Empty the trash to free up storage space
  • πŸ“… Smart Deletion Rules:

    • Promotions betterer than 2 days are automaticassociate deleted
    • Newsletters betterer than 7 days (unless HIGH priority) are deleted
    • Shutterfly emails are always deleted seeless of age
    • Receipts and meaningful write downs are archived instead of deleted
  • 🎬 YouTube Protection: All YouTube-roverhappinessed emails are upretaind and labeled as READ_ONLY (you’ll reply straightforwardly on YouTube)

  • ✍️ Smart Response Generation: Responses are tailored to the email context and integrate proper establishatting

  • πŸ’‘ Creative Sdeficiency Notifications: Fun, attention-grabbing notifications for meaningful emails

  • 🧡 Thread Handling: Properly tracks and regulates email threads to upretain conversation context

Contributions are receive! Phire sense free to surrender a Pull Request.

This project is licensed under the MIT License – see the LICENSE file for details.



Source join


Leave a Reply

Your email address will not be published. Required fields are marked *

Thank You For The Order

Please check your email we sent the process how you can get your account

Select Your Plan