Gmail Contact Counter
import logging
from gunicorn.app.base import BaseApplication
from app_init import app
# IMPORT ALL ROUTES
from routes import *
# Setup logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
class StandaloneApplication(BaseApplication):
def __init__(self, app, options=None):
self.application = app
self.options = options or {}
super().__init__()
def load_config(self):
# Apply configuration to Gunicorn
for key, value in self.options.items():
if key in self.cfg.settings and value is not None:
self.cfg.set(key.lower(), value)
Created: | Last Updated:
Gmail Reader Template Guide
This template provides a starting point for building applications that need to read Gmail messages. The app allows users to connect their Gmail account and analyze their email communication patterns.
Getting Started
- Click "Start with this Template" to begin using the Gmail Reader template
Initial Setup
Before testing the app, you'll need to set up Google OAuth credentials:
- Go to the Google Cloud Console
- Create a new project or select an existing one
- Enable the Gmail API for your project
- Go to "Credentials" and create OAuth 2.0 Client credentials
- Set the authorized redirect URI to your app's callback URL (you'll get this from Lazy after deployment)
- Copy your Client ID and Client Secret
- In the Lazy Builder, go to Environment Secrets and add:
GOOGLE_CLIENT_ID
: Your OAuth client IDGOOGLE_CLIENT_SECRET
: Your OAuth client secret
Test the App
- Click the "Test" button to deploy your app
- Lazy will provide you with your app's URL
Using the App
Once deployed, the app provides:
- A landing page with app information
- User authentication through Google
- Gmail connection functionality
- Email analysis features:
- View email frequency statistics
- Analyze contact patterns
- Filter results by time period (3-24 months)
The app will display: * Total emails sent * Number of unique contacts * Frequent contacts (those you've emailed more than 3 times) * Contact statistics with email counts
Integration Steps
After deployment:
- Update your Google Cloud Console OAuth credentials with the actual callback URL provided by Lazy
- The callback URL format will be:
https://[your-app-url]/gmail_callback
- Ensure you've enabled the necessary Gmail API scopes in your Google Cloud Console:
https://www.googleapis.com/auth/gmail.readonly
The app is now ready to analyze Gmail communication patterns for authenticated users.
Template Benefits
- Email Analytics for Sales Teams
- Helps sales professionals analyze their email communication patterns
- Identifies key client relationships based on email frequency
-
Enables better relationship management and follow-up strategies
-
Customer Service Performance Tracking
- Monitors support team email response patterns
- Tracks communication frequency with customers
-
Helps identify high-volume customer interactions requiring attention
-
Business Network Analysis
- Maps professional networks based on email interactions
- Identifies most frequent business contacts and key stakeholders
-
Helps in understanding and optimizing business relationships
-
Compliance and Communication Audit
- Assists in tracking communication patterns for regulatory compliance
- Provides documentation of client interactions
-
Helps maintain communication records for audit purposes
-
Team Collaboration Insights
- Analyzes internal communication patterns
- Identifies cross-departmental collaboration through email metrics
- Helps optimize team communication structures and workflows
Technologies




