A Python bot that automatically generates social media post suggestions (Twitter/X and LinkedIn) from your Reddit upvotes and WordPress blog posts, then delivers them via email.
- Reddit Integration: Fetches your upvoted posts from Reddit
- WordPress Integration: Retrieves your blog posts via REST API
- AI-Powered Content Generation: Uses OpenAI-compatible APIs to generate engaging social media posts
- Email Delivery: Sends a beautifully formatted HTML digest email
- Multi-language Support: Generate content in your preferred language
- Parallel Processing: Async API calls for faster content generation
- Retry Logic: Automatic retry with exponential backoff for failed requests
- Comprehensive Logging: Rotating log files for debugging and monitoring
- Fully Configurable: Extensive environment variable configuration
- Python 3.9 or higher
- Reddit account with API access
- WordPress site with REST API enabled
- OpenAI API key (or compatible API)
- SMTP server for email (e.g., Gmail)
cd social-content-bot
uv pip install -e .Copy the example environment file and edit it with your credentials:
cp .env.example .env
nano .envpython main.py- Go to Reddit App Preferences
- Click "Create App" or "Create Another App"
- Choose "script" as the app type
- Fill in the details:
- Name:
SocialContentBot(or any name you prefer) - Redirect URI:
http://localhost:8080(not used for script apps)
- Name:
- Note your credentials:
- Client ID: Under the app name (looks like
abc123xyz) - Client Secret: Labeled as "secret"
- Client ID: Under the app name (looks like
Add to .env:
REDDIT_CLIENT_ID=your_client_id_here
REDDIT_CLIENT_SECRET=your_client_secret_here
REDDIT_USER_AGENT=SocialContentBot/1.0 by YOUR_USERNAME
REDDIT_USERNAME=your_reddit_username
REDDIT_PASSWORD=your_reddit_passwordFor public sites, you only need the site URL. For private sites or to access draft posts:
- Log into WordPress Admin
- Go to Users → Profile
- Scroll to Application Passwords
- Enter a name (e.g., "Social Content Bot") and click "Add New Application Password"
- Copy the generated password
Add to .env:
WORDPRESS_SITE_URL=https://yourblog.com
WORDPRESS_USERNAME=your_username
WORDPRESS_APP_PASSWORD=your_app_passwordGet your API key from OpenAI Platform.
Add to .env:
OPENAI_API_KEY=sk-your-api-key-hereAlternative: You can use any OpenAI-compatible API by setting:
OPENAI_API_BASE=https://your-api-endpoint/v1
OPENAI_API_KEY=your-api-key- Enable 2-Factor Authentication on your Google Account
- Go to Google Account Security
- Search for "App Passwords" and create one
- Use the generated 16-character password
Add to .env:
SMTP_SERVER=smtp.gmail.com
SMTP_PORT=587
SMTP_USERNAME=your_email@gmail.com
SMTP_PASSWORD=your_app_password
EMAIL_FROM=your_email@gmail.com
EMAIL_TO=recipient@example.com| Provider | SMTP Server | Port |
|---|---|---|
| Outlook/Hotmail | smtp-mail.outlook.com | 587 |
| Yahoo | smtp.mail.yahoo.com | 587 |
| Fastmail | smtp.fastmail.com | 587 |
# Run with default settings
python main.py
# Dry run (don't send email, just display suggestions)
python main.py --dry-run
# Only process Reddit content
python main.py --skip-wordpress
# Only process WordPress content
python main.py --skip-reddit# Custom Reddit limit
python main.py --reddit-limit 20
# Generate more suggestions per item
python main.py --posts-per-item 3
# Generate in different language
python main.py --language it
# Save results to JSON
python main.py --output results.json
# Use custom env file
python main.py --env-file /path/to/.env
# Use synchronous mode (slower, for debugging)
python main.py --sync
# Custom log level
python main.py --log-level DEBUG| Option | Default | Description |
|---|---|---|
--reddit-limit |
10 | Max Reddit upvotes to fetch |
--posts-per-item |
2 | Suggestions per content item |
--language |
en | Language for generated content |
--skip-reddit |
false | Skip Reddit processing |
--skip-wordpress |
false | Skip WordPress processing |
--dry-run |
false | Don't send email |
--output, -o |
- | Save results to JSON file |
--env-file |
.env | Path to environment file |
--sync |
false | Use synchronous API calls |
--log-level |
INFO | Logging level (DEBUG, INFO, WARNING, ERROR) |