A powerful CLI tool for posting to multiple social media platforms with Puppeteer-based authentication. No restrictive APIs - just browser automation that works like a human.
- π Multi-platform posting: Support for X (Twitter), TikTok, Pinterest, LinkedIn, Reddit, Facebook, and more
- π¬ Auto recording: Intelligent selector recording with real-time validation and confidence scoring
- π€ AI-powered content generation: Generate viral social media posts on c0mpute, with OpenAI as an optional fallback
- π Browser-based authentication: Uses Puppeteer to login like a human - no API restrictions
- πΎ Session management: Saves login sessions to avoid repeated authentication
- π Rich content support: Text posts, link sharing, image uploads, and video uploads
- π― Platform targeting: Post to specific platforms or all at once
- π§ͺ Dry run mode: Preview posts without actually posting
- π Status monitoring: Check authentication status across all platforms
# Install globally with pnpm (recommended)
pnpm install -g @profullstack/social-poster
# Or with npm
npm install -g @profullstack/social-poster- Setup AI features (optional):
# Configure OpenAI API key for AI-powered content generation
sp setup- Login to platforms:
# Login to all platforms
sp login
# Login to specific platform
sp login x
sp login tiktok
sp login pinterest
sp login linkedin- Post content:
# Post text to all platforms
sp post "Hello world! π"
# Generate viral content with AI
sp post --prompt "Write about the future of web development" --link "https://example.com"
# Post with link
sp post --text "Check out this amazing tool!" --link "https://github.com/profullstack/social-poster"
# Post to specific platforms
sp post "Hello X and LinkedIn!" --platforms x,linkedin- Check status:
# View authentication status
sp status
# List available platforms
sp platformsPost content to social media platforms.
# Text post
sp post "Your message here"
# Link post with text
sp post --text "Check this out!" --link "https://example.com"
# Link only
sp post --link "https://example.com"
# Target specific platforms
sp post "Hello!" --platforms x,linkedin,reddit
# Dry run (preview without posting)
sp post "Test" --dry-runOptions:
--text, -t: Text content to post--link, -l: Link to share--prompt: AI prompt to generate viral social media content--style: Content style for AI generation (viral, professional, casual)--platforms, -p: Comma-separated list of platforms--dry-run: Preview post without actually posting
AI-Powered Examples:
# Generate viral content with AI
sp post --prompt "This post is about Example.com, please write a more elegant viral type post for all socials" --link "https://example.com"
# Generate professional content for LinkedIn
sp post --prompt "Share insights about remote work productivity" --style professional --platforms linkedin
# Generate casual content for Twitter
sp post --prompt "Funny observation about developers and coffee" --style casual --platforms xLogin to social media platforms using browser automation.
# Login to all platforms
sp login
# Login to specific platform
sp login x
sp login linkedin
sp login redditOptions:
--headless: Run browser in headless mode (default: true)
Show authentication status for all platforms.
sp statusList available platforms and their features.
# Basic list
sp platforms
# Detailed information
sp platforms --detailsConfigure OpenAI API key and other settings for AI-powered content generation.
sp setupThis interactive command will:
- Prompt for your OpenAI API key
- Test the API key connection
- Configure AI model preferences
- Set creativity level (temperature)
Show current configuration including AI settings.
sp configSocial Poster includes an advanced auto recording system that captures and validates CSS selectors for social media platforms automatically.
# Record selectors for a single platform
pnpm run auto-record x
pnpm run auto-record tiktok
pnpm run auto-record pinterest
# Record selectors for all platforms
pnpm run auto-record all- Real-time validation: Automatically validates known selectors every 5 seconds
- Confidence scoring: Rates selector reliability from 0-100%
- Enhanced categorization: Intelligently categorizes UI elements
- Visual feedback: Color-coded element highlighting (green=working, red=broken)
- Auto-save: Saves progress every 3 seconds
- Open browser: Tool opens browser windows for specified platforms
- Manual workflow: Perform normal login and posting workflows
- Auto capture: Tool records all interactions and validates selectors
- Save results: Press Ctrl+C to stop and save results to JSON file
For detailed documentation, see Auto Recording Guide.
| Platform | Status | Features |
|---|---|---|
| X (Twitter) | β Ready | Text posts, link sharing, auto recording |
| TikTok | β Ready | Video uploads, captions, auto recording |
| β Ready | Image pins, URL pins, descriptions, auto recording | |
| π§ In Progress | Text posts, link sharing, article publishing | |
| π§ In Progress | Text posts, link posts, subreddit targeting | |
| π§ In Progress | Text posts, link sharing, page posting | |
| Stacker News | π Planned | Link posts, Bitcoin rewards |
| Primal (Nostr) | π Planned | Decentralized posting |
| Hacker News | π Planned | Link submissions, discussions |
Configuration is stored in ~/.config/social-poster/config.json:
{
"platforms": {
"x": {
"enabled": true,
"lastLogin": "2024-01-01T00:00:00Z"
},
"linkedin": {
"enabled": true,
"lastLogin": "2024-01-01T00:00:00Z"
}
},
"general": {
"defaultPlatforms": ["x", "linkedin"],
"retryAttempts": 3,
"timeout": 30000,
"logLevel": "info",
"headless": true
},
"ai": {
"openaiApiKey": "sk-...",
"model": "gpt-4o-mini",
"maxTokens": 500,
"temperature": 0.7,
"enabled": true
}
}AI generation runs on the c0mpute peer network first, through @profullstack/ai-providers. It needs no setup: without a key you get a free tier of 10 calls a day, and an Infernet account key lifts that.
| Variable | |
|---|---|
C0MPUTE_API_KEY |
Infernet account key (ik_live_...). Also ai.c0mputeApiKey in the config, or c0mputeApiKey in new AIService({...}). |
C0MPUTE_TIMEOUT_MS |
Whole call, default 300000. c0mpute is slow (60 to 240 s per post is normal). |
C0MPUTE_DISABLED |
1 skips c0mpute and uses OpenAI only. |
OpenAI stays as the fallback when c0mpute fails. To configure it:
- Get an API key: Visit OpenAI Platform
- Run setup:
sp setup - Configure settings:
- Model: Choose between
gpt-4o-mini(fast, cost-effective),gpt-4o(more capable), orgpt-3.5-turbo(legacy) - Temperature: Control creativity (0.3 = conservative, 0.7 = balanced, 1.0 = creative)
- Max tokens: Limit response length (default: 500)
- Model: Choose between
Content Styles:
viral: Attention-grabbing, shareable content with emojis and trending languageprofessional: Business-appropriate, authoritative content for LinkedIncasual: Conversational, relatable content for Twitter/X and casual platforms
Login sessions are securely stored in ~/.config/social-poster/sessions.json. This includes:
- Browser cookies
- Local storage data
- Session storage data
- User agent and viewport settings
Sessions are automatically validated and refreshed as needed.
You can also use Social Poster as a Node.js module:
import { SocialPoster, quickPost } from '@profullstack/social-poster';
// Quick posting
const result = await quickPost({
text: "Hello from Node.js!",
type: "text"
}, {
platforms: ['x', 'linkedin']
});
// Advanced usage
const poster = new SocialPoster({
headless: true,
timeout: 30000
});
// Login
await poster.login('x');
// Post content
const postResult = await poster.post({
text: "Check out this link!",
link: "https://example.com",
type: "link"
});
// Clean up
await poster.close();- Node.js 20+
- pnpm (recommended)
# Clone the repository
git clone https://github.com/profullstack/social-poster.git
cd social-poster
# Install dependencies
pnpm install
# Run tests
pnpm test
# Run linting
pnpm lint
# Format code
pnpm formatsocial-poster/
βββ bin/
β βββ social-poster.js # CLI entry point
βββ src/
β βββ config-manager.js # Configuration management
β βββ browser-automation.js # Puppeteer automation
β βββ ai-service.js # AI-powered content generation
β βββ post-service.js # Multi-platform posting orchestration
β βββ selector-validator.js # Selector validation and recording
β βββ platforms/ # Platform implementations
β βββ x-com.js # X (Twitter) platform
β βββ tiktok.js # TikTok platform
β βββ pinterest.js # Pinterest platform
β βββ linkedin.js # LinkedIn platform
β βββ reddit.js # Reddit platform
β βββ ...
βββ scripts/ # Utility scripts
β βββ auto-record-platforms.js # Enhanced auto recording
β βββ record-selectors.js # Basic selector recording
β βββ validate-selectors.js # Selector validation
βββ test/ # Test files
β βββ platforms/ # Platform-specific tests
β βββ ...
βββ examples/ # Usage examples
β βββ basic-usage.js
β βββ ai-content-generation.js
β βββ batch-posting.js
β βββ multi-platform-posting.js
βββ docs/ # Documentation
β βββ AUTO_RECORDING.md # Auto recording guide
βββ index.js # Main module export
# Run all tests
pnpm test
# Run specific test suites
pnpm test:config
pnpm test:auth
pnpm test:platforms
pnpm test:cli
# Run tests with coverage
pnpm test:coverage- Create platform implementation in
src/platforms/ - Extend
BrowserAutomationclass - Implement required methods:
isLoggedIn(),login(),post() - Add tests in
test/platforms/ - Update configuration and CLI
Login fails or times out:
- Ensure you're not running in headless mode during initial setup:
sp login x --headless=false - Check for 2FA requirements
- Verify platform isn't blocking automated browsers
Posts fail to publish:
- Check authentication status:
sp status - Verify content length limits
- Ensure platform-specific requirements are met
Browser crashes or hangs:
- Increase timeout:
--timeout 60000 - Run with verbose logging:
--verbose - Check available system memory
Run with verbose logging to see detailed information:
sp post "test" --verbose- Fork the repository
- Create a feature branch:
git checkout -b feature/new-platform - Make your changes and add tests
- Run tests:
pnpm test - Submit a pull request
MIT License - see LICENSE file for details.
- Sessions are stored locally and encrypted
- No credentials are transmitted to external servers
- Browser automation mimics human behavior
- Rate limiting prevents platform abuse
- π Documentation
- π Issue Tracker
- π¬ Discussions
Made with β€οΈ by Profullstack