Gmail Webhook Application

Real-time Email Processing with Google Cloud Pub/Sub

📧
Gmail
New email arrives in inbox
☁️
Google Cloud Pub/Sub
Topic: incoming-mails-topic
Push notifications
🌐
Webhook Endpoint
zrok tunnel
/gmail-webhook
FastAPI Application
Process emails
Download attachments
Save data
📁
JSON Files
email_data/
Email metadata & content
📎
Attachments
attachments/{messageId}/
Downloaded files
💾
State Files
Processed messages
History tracking
🔄 Real-time Processing
Instant email notifications via Google Cloud Pub/Sub webhooks
🚫 Duplicate Prevention
Track processed messages and history IDs to prevent reprocessing
📎 Attachment Handling
Automatic download and organization of email attachments
💾 Persistent State
Maintain processing state across application restarts
📊 Data Export
Export email data as structured JSON files
🔧 Debug Tools
Manual check endpoints and status monitoring

Technology Stack

FastAPI Google Cloud Pub/Sub Gmail API OAuth 2.0 Python 3.7+ zrok Tunneling JSON Storage Uvicorn