OffX - Twitter Feed Summarizer

A Val Town application that summarizes your Twitter feed using AI.

Features

  • Fetch tweets from your Twitter home feed
  • Organize tweets by user-defined topics
  • Generate AI-powered summaries using OpenAI
  • Deliver summaries via email or Discord
  • Web dashboard for configuration and viewing summaries

Setup Instructions

Prerequisites

  • Deno installed
  • Val Town CLI installed: deno install -grAf jsr:@valtown/vt
  • Val Town account

Local Development

  1. Clone this repository:

    vt clone @yourusername/offx
    
  2. Navigate to the project directory:

    cd offx
    
  3. Make changes to the code as needed

  4. Push changes to Val Town:

    vt push
    

Environment Variables

The following environment variables need to be set in Val Town:

Authentication

  • AUTH_USERNAME: Username for dashboard authentication
  • AUTH_PASSWORD: Password for dashboard authentication

User & Admin

  • USER_EMAIL: Email address for summary delivery and notifications
  • ADMIN_EMAIL: Admin email for notifications

Email Delivery

  • EMAIL_DELIVERY_ENABLED: Enable/disable email delivery (true/false)
  • EMAIL_DELIVERY_FREQUENCY: Frequency of email delivery (daily, etc.)
  • EMAIL_MAX_SUMMARIES: Maximum number of summaries per email
  • EMAIL_JOB_NOTIFICATIONS: Enable job notification emails (true/false)
  • EMAIL_TO: Recipient email for certain cron jobs

Twitter API & Processing

  • TWITTER_BEARER_TOKEN: Your Twitter API bearer token
  • TWITTER_MAX_RETRIES: Max retries for Twitter API calls
  • TWITTER_INITIAL_DELAY_MS: Initial delay for retry logic (ms)
  • TWITTER_MAX_DELAY_MS: Max delay for retry logic (ms)
  • TWITTER_BACKOFF_MULTIPLIER: Backoff multiplier for retries
  • TWITTER_JITTER_FACTOR: Jitter factor for retry logic

Twitter Summarization

  • TWITTER_SUMMARIZATION_TIME_WINDOW: Time window for summarization (hours)
  • TWITTER_SUMMARIZATION_MAX_TWEETS: Max tweets to summarize
  • TWITTER_SUMMARIZATION_INCLUDE_MEDIA: Include media in summaries (true/false)
  • TWITTER_SUMMARIZATION_INCLUDE_SENTIMENT: Include sentiment analysis (true/false)
  • TWITTER_SUMMARIZATION_EMAIL_NOTIFICATIONS: Email notifications for summarization (true/false)
  • TWITTER_FILTER_KEYWORDS: Comma-separated keywords to filter tweets
  • TWITTER_FILTER_EXCLUDE_KEYWORDS: Comma-separated keywords to exclude tweets
  • TWITTER_FILTER_INCLUDE_USERS: Comma-separated Twitter usernames to include
  • TWITTER_FILTER_EXCLUDE_USERS: Comma-separated Twitter usernames to exclude
  • TWITTER_FILTER_LANGUAGES: Comma-separated language codes to filter tweets
  • TWITTER_FILTER_INCLUDE_RETWEETS: Include retweets (true/false)
  • TWITTER_FILTER_INCLUDE_REPLIES: Include replies (true/false)

Twitter Sentiment

  • TWITTER_SENTIMENT_USE_AI: Use AI for sentiment analysis (true/false)
  • TWITTER_SENTIMENT_BATCH_SIZE: Batch size for sentiment analysis
  • TWITTER_SENTIMENT_JOB_BATCH_SIZE: Batch size for sentiment job cron
  • TWITTER_SENTIMENT_JOB_NOTIFY: Enable notifications for sentiment jobs (true/false)

Project Structure

offx/
├── backend/
│   ├── database/      # SQLite database operations
│   └── routes/        # API route handlers
├── frontend/          # Frontend HTML, CSS, and JavaScript
│   ├── index.html     # Main page served for frontend
│   └── index.tsx      # Main React application entry point
├── shared/            # Shared code between frontend and backend
└── README.md          # This file

Deployment

This project is designed to run on Val Town. After pushing your code with vt push, you can access the application at:

https://val.town/v/yourusername/offx

Development Commands

  • vt push: Push local changes to Val Town
  • vt pull: Pull the latest changes from Val Town
  • vt status: Show working tree status
  • vt browse: Open the Val in a web browser

License

MIT