This project automates LinkedIn posts creation using the LinkedIn API and Claude AI for content generation.
- Automated LinkedIn post creation using Claude AI
- Scheduled posts every 4 hours (9 AM, 1 PM, 5 PM, 9 PM)
- No posts during night time (10 PM to 9 AM)
- REST API for manual post creation with AI content generation option
- MongoDB integration for post tracking
- Install dependencies:
npm install- Create a
.envfile in the root directory with the following variables:
# LinkedIn API Configuration
LINKEDIN_CLIENT_ID=your_client_id_here
LINKEDIN_CLIENT_SECRET=your_client_secret_here
LINKEDIN_ACCESS_TOKEN=your_access_token_here
LINKEDIN_USER_ID=your_linkedin_user_id_here
# MongoDB Configuration
MONGODB_URI=mongodb://localhost:27017/linkedin_automation
# Claude API Configuration
CLAUDE_API_KEY=your_claude_api_key_here
# Server Configuration
PORT=3000
-
To get LinkedIn API credentials:
- Go to LinkedIn Developer Portal
- Create a new application
- Get the client ID and client secret
- Generate an access token with appropriate permissions
- Get your LinkedIn user ID
-
To get Claude API key:
- Go to Anthropic Console
- Create an account and get your API key
- Start the server:
npm run server-
The server will automatically create posts at:
- 9:00 AM
- 1:00 PM
- 5:00 PM
- 9:00 PM
-
API Endpoints:
- Create a post manually:
# With custom content curl -X POST "http://localhost:3000/api/posts" \ -H "Content-Type: application/json" \ -d '{"content": "Your post content here"}' # With AI-generated content curl -X POST "http://localhost:3000/api/posts?ai=true" \ -H "Content-Type: application/json"
- Get recent posts:
curl "http://localhost:3000/api/posts"
- Create a post manually:
- Posts are created every 4 hours
- Active hours: 9:00 AM to 10:00 PM
- No posts during night time
- Content is generated using Claude AI
Make sure to follow LinkedIn's API usage guidelines and rate limits. This is for educational purposes only.