Skip to content

motyar/auto0

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zenmic LinkedIn Engine 🚀

A "Digital Zamindar" automation system that generates and delivers professional PDF carousels for LinkedIn using GitHub Actions, GPT-4o-mini, and Python.

🎯 Overview

This project automates LinkedIn content creation by:

  • 🤖 Using AI to generate fresh, trending content ideas on every run
  • 📄 Creating professional multi-page PDF carousels (5-7 slides)
  • 🎨 Supporting 5 modern color themes
  • 📱 Delivering content to Telegram for easy manual posting
  • ⏰ Running automatically every 10 minutes via GitHub Actions

✨ What's New: PDF Carousel Generation

The engine now generates professional LinkedIn carousels with:

  • Multi-page PDFs: 7 slides per carousel (Cover + 5 Content + CTA)
  • LinkedIn-optimized: 1080x1080px per slide (perfect for LinkedIn carousels)
  • Real Text Content: PDFs contain actual selectable text (not just images)
  • Professional Fonts: Uses Lato fonts with automatic fallback to system fonts
  • 5 Color Themes: Professional, Bold, Minimalist, Gradient, Warm
  • AI-Generated Ideas: Fresh trending content ideas on every run
  • Carousel-Optimized Content: Structured hooks, slides, and CTAs
  • Content Tracking: Carousel content saved to brain.json and history.json
  • Backward Compatible: Single image generation still works

PDF Carousel Success

🏗️ Architecture

┌──────────────────┐
│  AI Idea Gen     │  ← GPT-4 generates 3 trending ideas
│  (or brain.json) │
└────────┬─────────┘
         │
         ▼
┌──────────────────┐
│    main.py       │  ← Orchestrates the workflow
└────────┬─────────┘
         │
         ├─→ GPT-4o-mini API (generates carousel content)
         │
         ├─→ image_gen.py (creates 7-slide PDF carousel)
         │
         ├─→ Telegram API (delivers PDF)
         │
         └─→ history.json (tracks posts)

📋 Features

  • Zero-Cost Infrastructure: Runs entirely on GitHub's free tier
  • AI-Generated Ideas: Fresh trending content ideas on every run
  • Professional PDF Carousels: 7-slide PDFs with actual selectable text content
  • Modern Typography: Uses Lato fonts (similar to Google Fonts) for professional appearance
  • 5 Color Themes: Choose from Professional, Bold, Minimalist, Gradient, or Warm
  • Smart Content Generation: GPT-4o-mini creates carousel-optimized content
  • Content Tracking: Complete carousel content saved to brain.json for future reference
  • Telegram Integration: One-tap posting maintains "organic" feel for LinkedIn
  • Comprehensive Fallbacks: Graceful degradation if any feature fails
  • Backward Compatible: Single image generation still works

🚀 Setup Instructions

1. Clone the Repository

git clone https://github.com/motyar/auto0.git
cd auto0

2. Configure Secrets

Add these secrets to your GitHub repository:

  1. Go to: SettingsSecrets and variablesActionsNew repository secret

Required secrets:

Optional (but recommended) secrets:

  • TELEGRAM_BOT_TOKEN: Create a bot via @BotFather
  • TELEGRAM_CHAT_ID: Message your bot, then visit https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates

Optional (PDF carousel configuration):

  • THEME: Choose from professional, bold, minimalist, gradient, or warm (default: professional)
  • USE_AI_IDEAS: Set to true for AI-generated ideas or false to use brain.json (default: true)
  • CAROUSEL_SLIDES: Number of content slides, 5-10 (default: 7)

3. Enable GitHub Actions

  1. Go to the Actions tab in your repository
  2. Click "I understand my workflows, go ahead and enable them"

4. Test the Workflow

You can manually trigger a test run:

  1. Go to Actions tab
  2. Click "Daily LinkedIn Post Generator"
  3. Click "Run workflow" → "Run workflow"

🧪 Local Testing

# Install dependencies
pip install -r requirements.txt

# Create .env file
cp .env.example .env
# Edit .env with your API keys

# Run the engine
python main.py

📁 Project Structure

auto0/
├── .github/
│   └── workflows/
│       └── daily_post.yml      # GitHub Actions workflow
├── brain.json                  # Content idea repository (fallback)
├── ideas_generated.json        # AI-generated ideas (auto-created)
├── history.json                # Posting history
├── main.py                     # Main orchestration script
├── image_gen.py                # PDF carousel & image generation
├── requirements.txt            # Python dependencies
├── fonts/                      # Google Fonts cache (auto-created)
├── output/                     # Generated PDFs and images
│   ├── linkedin_carousel_*.pdf # Generated PDF carousels
│   └── linkedin_post_*.png     # Generated images (fallback)
└── README.md                   # This file

🎨 Customization

Choose a Color Theme

Set the THEME environment variable or GitHub secret to one of:

  • professional: Dark blue background with bright blue accents (default)
  • bold: Black background with neon green/cyan accents
  • minimalist: Light gray/white background with coral/red accents
  • gradient: Purple-to-blue gradient background
  • warm: Warm colors (coral, cream, orange tones)

Configure AI Ideas vs brain.json

By default, the engine uses AI to generate fresh ideas on every run. To use the static brain.json instead:

  • Set USE_AI_IDEAS=false in your environment or GitHub secrets
  • Edit brain.json to add your own content ideas

Adjust Carousel Length

Set CAROUSEL_SLIDES environment variable to control the number of content slides (5-10):

  • Default: 7 slides (Cover + 5 Content + CTA)
  • Minimum: 5 slides (Cover + 3 Content + CTA)
  • Maximum: 10 slides (Cover + 8 Content + CTA)

Modify Brand Colors (Advanced)

For custom colors beyond the 5 themes, edit the THEMES dictionary in image_gen.py:

THEMES = {
    "my_custom_theme": {
        "bg": "#1A1A1A",        # Background color
        "accent": "#FF6B6B",    # Accent color
        "text": "#FFFFFF",      # Text color
        "secondary": "#2C2C2C"  # Secondary color
    }
}

Then set THEME=my_custom_theme in your environment.

Add More Ideas (when using brain.json)

Edit brain.json to add your own content ideas:

{
  "id": 31,
  "title": "Your Idea Title",
  "description": "Your idea description",
  "used": false
}

Change Schedule

Edit .github/workflows/daily_post.yml:

schedule:
  - cron: '0 4 * * 1-5'  # 9:30 AM IST, Mon-Fri

🔄 How It Works

  1. Scheduler Triggers: GitHub Actions runs at 9:30 AM IST (Mon-Fri)
  2. Idea Selection: Picks the first unused idea from brain.json
  3. Content Generation: GPT-4o-mini creates:
    • Hook (attention-grabbing opening)
    • Body (5-7 actionable SOP steps)
    • CTA (call-to-action linking to Zenmic.com)
    • Visual data (title + 3 key points)
  4. Image Creation: Pillow generates a branded 1200x675 image
  5. Telegram Delivery: Sends post text and image to your phone
  6. State Update: Marks idea as used, logs to history.json
  7. Auto-Commit: Pushes changes back to repository

📱 Why Telegram?

LinkedIn's algorithm heavily penalizes obvious automation. By sending content to Telegram first:

  • ✅ You review quality before posting
  • ✅ Manual posting appears "organic" to LinkedIn
  • ✅ One-tap sharing from mobile
  • ✅ Maintains human touch and engagement

This is the "Pure Organic" strategy that avoids shadowbans.

🔐 Security Notes

  • Never commit .env file (it's in .gitignore)
  • Store all API keys as GitHub Secrets
  • The OpenAI API key only needs Chat Completions permission
  • Telegram bot can only send messages (read-only chat access)

📊 Monitoring

Check the Actions tab to:

  • View run history
  • Download generated images (stored as artifacts for 30 days)
  • Debug any failures
  • Monitor API costs

💰 Cost Estimate

  • GitHub Actions: Free (2,000 minutes/month)
  • GPT-4o-mini: $0.0001 per post ($0.002/month for 20 posts)
  • Total: Essentially FREE

🤝 Contributing

This is an internal automation tool, but feel free to:

  1. Fork the repository
  2. Customize for your needs
  3. Share improvements via PR

📄 License

MIT License - Use it however you want!

🆘 Troubleshooting

"No module named 'openai'"

pip install -r requirements.txt

"OPENAI_API_KEY environment variable not set"

  • Add the secret to GitHub repository settings
  • For local testing, create a .env file

PDFs not containing selectable text

  • Fixed in latest version: PDFs now use ReportLab's native text rendering
  • Text is fully selectable and searchable in generated PDFs
  • Font system automatically uses Lato (clean, modern) with fallback to DejaVu/system fonts
  • PDF file sizes are much smaller (50-60KB vs 200KB+ for image-based PDFs)

Fonts not looking professional

  • Fixed in latest version: Now uses Lato fonts (similar to Google Fonts like Poppins/Inter)
  • Automatic fallback to system fonts if Lato is unavailable
  • No internet connection required for fonts to work

Carousel content not being tracked

  • Fixed in latest version: Complete carousel content now saved to:
    • brain.json: Stores generated carousel for each idea under generated_carousel field
    • history.json: Tracks all posted content with full carousel data
  • This allows you to review and reuse successful content patterns

Images not generating

  • The system auto-creates template.png on first run
  • Check that Pillow installed correctly
  • Verify font availability (uses Lato or DejaVu Sans)

Workflow not running

  • Check that GitHub Actions are enabled
  • Verify cron schedule in UTC (not IST)
  • Check workflow permissions in Settings → Actions

🎓 Learning Resources


Built with ❤️ for Zenmic.com | Content That Converts

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages