Automatically processes Google Alerts emails, analyzes articles with AI, and delivers daily intelligence briefs to Slack. Fully configurable for any topic or industry you want to monitor.
- 📧 Fetches Google Alerts emails via IMAP
- 📰 Monitors Hacker News front page for relevant articles (AI-filtered)
- 🔍 Extracts and scrapes article content
- 🤖 AI-powered analysis with multiple providers (Claude, OpenAI, Gemini)
- 💾 SQLite database for historical tracking
- 📊 Daily intelligence briefs with consolidated analysis
- 📈 Historical context awareness (avoids repetition, identifies multi-day trends)
- ⏰ Automated daily runs at 11:01 AM
- 🔄 Deduplication (skips already-processed articles)
- 🔌 Pluggable AI providers - easily switch between models
npm installCreate a Gmail App Password:
- Go to Google Account settings
- Security → 2-Step Verification (enable if not already)
- Security → App passwords
- Generate password for "Mail"
- Copy the 16-character password
The tool supports three AI providers. Choose one and get its API key:
Option A: OpenAI (GPT-4)
- Sign up at https://platform.openai.com
- Create an API key
- Copy the key (starts with
sk-proj-)
Option B: Anthropic (Claude)
- Sign up at https://console.anthropic.com
- Create an API key
- Copy the key (starts with
sk-ant-)
Option C: Google (Gemini)
- Get API key at https://makersuite.google.com/app/apikey
- Copy the key
- Go to https://api.slack.com/apps
- Create new app → From scratch
- Incoming Webhooks → Activate
- Add New Webhook to Workspace
- Select channel and copy webhook URL
Copy .env.example to .env:
cp .env.example .envEdit .env with your credentials:
IMAP_HOST=imap.gmail.com
IMAP_PORT=993
IMAP_USER=your-email@gmail.com
IMAP_PASSWORD=your-16-char-app-password
# Choose one: claude, openai, or gemini
AI_PROVIDER=openai
# Only the API key for your chosen provider is required
ANTHROPIC_API_KEY=sk-ant-xxxxx
OPENAI_API_KEY=sk-proj-xxxxx
GEMINI_API_KEY=xxxxx
SLACK_WEBHOOK_URL=https://hooks.slack.com/services/YOUR/WEBHOOK/URL
CRON_SCHEDULE=1 11 * * *
# Intelligence Brief Configuration (optional)
BRIEF_DOMAIN="your monitored topics"
BRIEF_TITLE="Intelligence Brief"Optional Configuration:
BRIEF_DOMAIN: The topic/industry you're monitoring (e.g., "AI commerce", "cybersecurity news", "climate tech"). Used in AI analysis prompts. Defaults to "your monitored topics".BRIEF_TITLE: The title shown in Slack notifications (e.g., "Tech News Brief", "Security Intelligence"). Defaults to "Intelligence Brief".
npm run buildStarts the scheduler and runs daily at 11:01 AM:
npm startProcess emails immediately without scheduling:
npm run dev -- --testRun in development mode with ts-node:
npm run devTo switch between AI providers, simply change the AI_PROVIDER value in your .env file:
# Use OpenAI (GPT-4)
AI_PROVIDER=openai
# Or use Claude
AI_PROVIDER=claude
# Or use Gemini
AI_PROVIDER=geminiThe tool will automatically use the correct API key and model. No code changes needed!
src/
├── index.ts # Main orchestrator + scheduler
├── email.ts # IMAP email fetching
├── parser.ts # Extract article links from HTML
├── hackernews.ts # HN front page fetching + AI filtering
├── scraper.ts # Puppeteer article scraping
├── analyzer.ts # Creates intelligence briefs from articles
├── providers/
│ ├── base.ts # AI provider interface
│ ├── claude.ts # Claude implementation
│ ├── openai.ts # OpenAI implementation
│ ├── gemini.ts # Gemini implementation
│ └── factory.ts # Provider factory
├── slack.ts # Slack message formatting
├── database.ts # SQLite operations
└── types.ts # TypeScript interfaces
db/
└── alerts.db # SQLite database (auto-created)
articles
- url, title, source, topic, content, published_date, fetched_date
daily_briefs
- date, executive_summary, key_developments (JSON), notable_articles (JSON), sentiment_summary, trends, what_to_watch, article_count
Daily intelligence brief includes:
- Executive Summary: 2-3 sentence overview of what's happening today
- Key Developments: 3-5 unique/important developments (similar stories consolidated)
- Notable Articles: Curated articles with why they matter
- Sentiment Summary: Overall mood and reasoning (optimistic/cautious/neutral/hype)
- Trends: Patterns across articles (early hype vs practical implementation)
- What to Watch: Emerging questions and potential next developments
No emails found
- Check Google Alerts are sending to the configured email
- Verify IMAP credentials
- Check emails aren't already marked as read
Scraping fails
- Some sites block automated access
- Tool will skip failed articles and continue
Claude API errors
- Check API key is valid
- Verify account has credits
- Tool will fallback to basic analysis if needed
Slack not receiving
- Verify webhook URL is correct
- Check webhook hasn't been revoked
- Test webhook with curl
# Install Node.js 18+
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs
# Install Chromium for Puppeteer
sudo apt-get install -y chromium-browser fonts-liberation
# Or install required Puppeteer dependencies
sudo apt-get install -y \
libasound2 libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-0 \
libcups2 libdbus-1-3 libdrm2 libgbm1 libgtk-3-0 libnspr4 \
libnss3 libwayland-client0 libxcomposite1 libxdamage1 \
libxfixes3 libxkbcommon0 libxrandr2 xdg-utils1. Clone the repository:
git clone https://github.com/YOUR_USERNAME/feeder.git
cd feeder2. Install dependencies:
npm install3. Configure environment:
cp .env.example .env
nano .env
# Fill in all your credentials:
# - IMAP settings (Gmail app password)
# - AI provider and API key
# - Slack webhook URL4. Build the project:
npm run build5. Test it works:
npm run dev -- --testPM2 is a production process manager that handles restarts, logging, and monitoring.
Install PM2:
sudo npm install -g pm2Start the application:
pm2 start dist/index.js --name feederConfigure auto-start on reboot:
pm2 startup
# Follow the instructions printed
pm2 saveUseful PM2 commands:
pm2 status # Check status
pm2 logs feeder # View logs
pm2 logs feeder --lines 100 # View last 100 lines
pm2 restart feeder # Restart
pm2 stop feeder # Stop
pm2 delete feeder # Remove from PM2
pm2 monit # Monitor resourcesConfigure log rotation:
pm2 install pm2-logrotate
pm2 set pm2-logrotate:max_size 10M
pm2 set pm2-logrotate:retain 7Create /etc/systemd/system/feeder.service:
[Unit]
Description=Google Alerts Intelligence Tool
After=network.target
[Service]
Type=simple
User=YOUR_USERNAME
WorkingDirectory=/home/YOUR_USERNAME/feeder
ExecStart=/usr/bin/node /home/YOUR_USERNAME/feeder/dist/index.js
Restart=always
RestartSec=10
Environment=NODE_ENV=production
[Install]
WantedBy=multi-user.targetEnable and start:
sudo systemctl daemon-reload
sudo systemctl enable feeder
sudo systemctl start feeder
sudo systemctl status feederCheck the scheduled runs are working:
# With PM2
pm2 logs feeder | grep "Intelligence Run"
# Check database for daily briefs
sqlite3 db/alerts.db "SELECT date, article_count FROM daily_briefs ORDER BY date DESC LIMIT 5"Ensure your server is set to the correct timezone for cron scheduling:
# Check current timezone
timedatectl
# Set timezone (example: US Eastern)
sudo timedatectl set-timezone America/New_York
# Or for UTC
sudo timedatectl set-timezone UTCPuppeteer issues:
On ARM64/aarch64 systems, Puppeteer's bundled Chrome won't work. Add this to your .env file:
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browserOr export it as an environment variable:
export PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browserPermission issues:
# Ensure db directory is writable
chmod 755 dbCheck logs:
pm2 logs feeder --err # Error logs only
pm2 logs feeder --lines 200 # More contextGPL-3.0