AI-Powered Social Media Auto-Poster Development by Abdul RehmanAI-Powered Social Media Auto-Poster Development by Abdul Rehman

AI-Powered Social Media Auto-Poster Development

Abdul  Rehman

Abdul Rehman

Social Media Auto-Poster

A self-hosted multi-platform social media automation tool with AI-powered content generation, scheduling, and engagement.

Features

Multi-Platform Publishing

LinkedIn - Personal profiles and company pages
Twitter/X - Full API v2 support with engagement
Facebook - Pages publishing
Instagram - Coming soon

Three Content Modes

Manual - Write your own content with full control
Structured - Provide key details, AI writes the post
AI Generate - Describe your topic, AI creates everything

Smart AI Content Generation

Platform-specific character limits enforced (280 for Twitter, 3000 for LinkedIn)
Human-like writing style (no AI-sounding phrases)
Customizable tone, emojis, and hashtags
Learning from past performance
16 Groq models with smart load balancing

ICP Twitter Engagement

Autonomous agent finds your Ideal Customer Profile on Twitter
Searches for relevant conversations
Generates contextual, value-adding replies
Tracks engagement outcomes

Analytics and Learning

Per-platform metrics collection
Performance-based content optimization
Engagement history tracking

Token Management

Automatic token refresh
Email alerts when refresh fails
24-hour cooldown to prevent spam

Media Support

Images and videos (up to 100MB)
S3-compatible storage
Platform-specific media handling

Tech Stack

Framework: Next.js 15 (App Router)
Database: MongoDB
Auth: NextAuth.js v5
AI: Groq (16 models with load balancing)
Storage: S3-compatible (MinIO, AWS S3)
Email: Resend
Styling: Tailwind CSS

Quick Start

Prerequisites

Node.js 20+
MongoDB instance
MinIO or S3-compatible storage
Platform Developer Apps (LinkedIn, Twitter, Facebook)
Groq API key
Resend API key (for email alerts)

Environment Setup

Copy .env.example to .env and configure:

Development


Docker Deployment


Architecture


Cron Jobs

Schedule Job Description */5 * * * * publish Publish scheduled posts */15 * * * * engage LinkedIn auto-engagement 0 */12 * * * icp-engage Twitter ICP engagement (2x/day) 0 * * * * token-refresh Check and refresh expiring tokens 0 6 * * * auto-generate Daily AI content generation 0 */6 * * * collect-metrics Gather platform analytics

API Routes

Posts

Route Method Description /api/posts GET List all posts /api/posts POST Create a new post /api/posts/[id] GET/PUT/DELETE Manage single post /api/posts/[id]/retry POST Retry failed post

Content Generation

Route Method Description /api/generate POST Generate AI content /api/ai/usage GET View AI model usage stats

Pages and Connections

Route Method Description /api/pages GET/POST Manage pages/brands /api/auth/twitter GET Start Twitter OAuth /api/auth/facebook GET Start Facebook OAuth

Engagement

Route Method Description /api/engagements GET List engagements /api/icp-engagement GET ICP engagement history

System

Route Method Description /api/health GET Health check /api/cron/* GET Cron job endpoints

ICP Twitter Engagement

The system autonomously engages with your Ideal Customer Profile:
Analyzes your page - Topics, audience, value proposition
Generates search queries - Based on ICP pain points
Finds relevant tweets - From potential customers
Evaluates relevance - Scores 0-10 for ICP match
Generates replies - Contextual, value-adding (not promotional)
Posts replies - With rate limiting and safeguards

Safeguards

Minimum relevance score: 7/10
Max 1 reply per run (cost optimized)
24-hour cooldown per user
Filters: 100-100k followers, skip verified
Quality validation (no sycophantic replies)

Platform Character Limits

Platform Limit AI Guidance Twitter 280 Aim for 200-250 LinkedIn 3,000 Aim for 800-1,200 Facebook 63,206 Aim for 500 Instagram 2,200 Front-load first 125

AI Quality

The AI is tuned to write like a professional, not a marketer:
Avoided:
Em dashes
"Not just X, but Y"
Marketing buzzwords
AI phrases: "It's worth noting", "At its core"
Encouraged:
First person voice
Contractions (don't, it's)
Varied sentence length
Specific examples
Thoughtful questions

License

MIT
Like this project

Posted Jun 18, 2026

Developed an AI-powered social media automation tool for multi-platform publishing and engagement tracking.