An automated system that fetches AI-related newsletters from your Gmail, summarizes them using GPT models, and sends you a beautifully formatted weekly digest with role-specific advice and product opportunities.
- ๐ง Gmail Integration: Automatically fetches and filters AI-related emails
- ๐ค AI-Powered Summarization: Intelligent summaries with web search for fact-checking
- ๐ผ Role-Based Advice: Actionable tips for various professions
- ๐ Product Opportunities: Specific suggestions for your apps based on weekly news
- ๐ฐ Cost Optimized: Uses consumption-based pricing on both Azure and AWS
- ๐จ Beautiful Emails: React Email + Tailwind for professional formatting
- Bun installed
- Azure account or AWS account configured
- Google Cloud project with Gmail API enabled
- OpenAI API key
- Resend API key for email delivery
git clone <your-repo>
cd ai-digest
bun install- Create a new project in Google Cloud Console
- Enable the Gmail API
- Create OAuth 2.0 credentials (Desktop application type)
- Download the credentials
Then generate your refresh token:
bun run generate:oauthcp .env.example .env
# Edit .env with your credentialsRequired environment variables:
- Gmail OAuth credentials
- OpenAI API key
- Resend API key
- Recipient email address
bun run deploy:awsbun run deploy:azure# Regular weekly digest (last 7 days)
curl https://your-function-url/run-now
# Cleanup mode (process ALL unarchived emails)
curl "https://your-function-url/run-now?cleanup=true"- Weekly Mode (default): Processes emails from the last 7 days
- Cleanup Mode: Processes ALL unarchived emails in batches
Edit your product context in the Terraform configuration to get personalized product recommendations:
PRODUCT_CONTEXT = jsonencode({
owner = "Your Name"
apps = [
{
name = "App Name"
url = "https://example.com"
desc = "Description"
}
]
})The digest runs automatically every Sunday at 8:00 AM. To change the schedule:
- AWS: Edit EventBridge rule in Terraform
- Azure: Edit timer trigger in function.json
# Preview email templates
bun run dev:email
# Run tests
bun run test # Full test suite
bun run test:fast # Fast tests only (excludes integration tests)
bun run test:integration # Integration tests only
# Type checking
bun run typecheck
# Linting
bun run lint# Build for both platforms
bun run build:all
# Build for specific platform
bun run build:aws
bun run build:azureDesigned to run within free/minimal tiers:
- Compute: < $1/month (serverless functions)
- Storage: < $1/month (minimal data)
- OpenAI: ~$0.01-0.10 per digest
- Total: < $5/month
- Ensure Gmail API is enabled
- Verify OAuth scope includes
gmail.modify - Regenerate refresh token if expired
- Check function logs in CloudWatch (AWS) or Application Insights (Azure)
- Verify all secrets are configured correctly
- Ensure managed identity/IAM roles have proper permissions
- Verify Resend API key and sender domain
- Check Resend dashboard for bounces/blocks
- Ensure recipient email is correct
For issues or questions, please open an issue on GitHub.
MIT