This guide walks you through setting up the LinkedIn Post Bot. Follow each step carefully to avoid errors.
| Requirement | Where to Get It | Cost |
|---|---|---|
| LinkedIn Developer App | linkedin.com/developers | Free |
| Groq API Key | console.groq.com | Free |
| GitHub Account | github.com | Free |
| Unsplash API Key (optional) | unsplash.com/developers | Free |
# Backend
pip install -r requirements.txt
# Frontend
cd web
npm installOpen two terminal windows:
Terminal 1 - Backend:
cd backend
python app.pyBackend runs at: http://localhost:8000
Terminal 2 - Frontend:
cd web
npm run devFrontend runs at: http://localhost:3000
- Go to LinkedIn Developers
- Click "Create app"
- Fill in:
- App name: "LinkedIn Post Bot" (or your choice)
- LinkedIn Page: Select your company page (create one if needed)
- Privacy policy URL: Any URL (can be your website)
- App logo: Any square image
- Click "Create app"
This step is ESSENTIAL - OAuth WILL FAIL without these products!
- Go to the "Products" tab in your app
- Request access to BOTH:
- ✅ "Sign In with LinkedIn using OpenID Connect"
- ✅ "Share on LinkedIn"
- Wait for approval (usually instant)
- Go to the "Auth" tab
- Under "OAuth 2.0 settings", add this exact redirect URL:
http://localhost:8000/auth/linkedin/callback - Click "Update"
In the "Auth" tab, verify these scopes are listed:
openidprofileemailw_member_social
- In the "Auth" tab, find "Application credentials"
- Copy your Client ID
- Click "Show" to reveal and copy your Client Secret
- Go to console.groq.com
- Sign up (Google/GitHub login available)
- Navigate to "API Keys" in the sidebar
- Click "Create API Key"
- Copy the key (starts with
gsk_)
⚠️ Save it immediately - you can't see it again!
- Open the app at
http://localhost:3000 - Go to Settings page
- Enter your LinkedIn Client ID and Client Secret
- Click "Connect LinkedIn Account"
- Authorize the app in the popup
- Enter your Groq API Key
- Enter your GitHub Username
- (Optional) Enter your Unsplash Access Key
- Click "Save & Go to Dashboard"
Go to the Dashboard to start generating AI-powered LinkedIn posts from your GitHub activity!
Cause: Products not added to your LinkedIn app
Fix: Go to Products tab → Add "Sign In with LinkedIn using OpenID Connect" AND "Share on LinkedIn"
Cause: Invalid client secret
Fix:
- Go to LinkedIn Developer Portal → Auth tab
- Click "Reset" next to Client Secret
- Copy the NEW secret and update in Settings
Cause: Old API endpoint (now fixed in app)
Fix: Update to latest version of this app
Cause: Backend not running
Fix: Make sure python app.py is running in the backend folder
Cause: Browser storage issue
Fix: Clear localStorage and reconnect LinkedIn
For developers who prefer .env configuration:
# Required
GROQ_API_KEY=gsk_your_api_key
GITHUB_USERNAME=your_username
# LinkedIn OAuth
LINKEDIN_CLIENT_ID=your_client_id
LINKEDIN_CLIENT_SECRET=your_client_secret
LINKEDIN_OAUTH_SCOPE=openid profile email w_member_social
# Optional
UNSPLASH_ACCESS_KEY=your_unsplash_keyPlace this file in the root directory of the project (not in /backend).
- The script will output:
- ✅ Access Token
- ✅ User URN
Keep these safe! You'll need them in the next step.
- Go to Groq Console
- Sign up for a free account
- Verify your email
- Navigate to API Keys
- Click "Create API Key"
- Name it (e.g., "LinkedIn Bot")
- Copy the key immediately (you won't see it again!)
Free Tier: 30 requests/minute - plenty for this bot!
Simply use your GitHub username (e.g., your-username)
Without a token: 60 API requests/hour With a token: 5,000 API requests/hour
To create a token:
- Go to GitHub Settings → Tokens
- Click "Generate new token (classic)"
- Name it: "LinkedIn Bot"
- Select scopes:
- ✅
public_repo(access public repositories)
- ✅
- Click "Generate token"
- Copy immediately (you won't see it again!)
- Go to Unsplash Developers
- Sign up or log in
- Go to Your Applications
- Click "New Application"
- Accept the terms
- Fill in:
- Application name: LinkedIn Post Bot
- Description: Bot for posting to LinkedIn
- Click "Create Application"
From your application page, copy the Access Key
Free Tier: 50 requests/hour
Copy the example file:
# Windows
copy .env.example .env
# macOS/Linux
cp .env.example .envOpen .env and replace all placeholder values:
# LinkedIn OAuth
LINKEDIN_ACCESS_TOKEN=AQT... # From Step 3.4
LINKEDIN_USER_URN=abc123... # From Step 3.4
LINKEDIN_CLIENT_ID=77hpf... # From Step 3.3
LINKEDIN_CLIENT_SECRET=WPL_AP1... # From Step 3.3
LINKEDIN_REDIRECT_URI=http://localhost:8000/callback
# GitHub
GITHUB_USERNAME=your-username # Your actual GitHub username
GITHUB_TOKEN=ghp_... # From Step 5.2 (optional)
# Groq API
GROQ_API_KEY=gsk_... # From Step 4.2
# Unsplash (Optional)
UNSPLASH_ACCESS_KEY=... # From Step 6.3 (optional).gitignore.
Edit the LINKEDIN_PERSONA in services/ai_service.py (lines 11-90) to match your voice:
LINKEDIN_PERSONA = """You are writing LinkedIn posts for [YOUR NAME], a [YOUR ROLE].
ABOUT THE VOICE:
- [Your characteristics]
- [Your expertise]
- [Your interests]
...In bot.py, you can modify:
- Test Mode: Line 535 -
TEST_MODE = True/False - Max Posts: Via environment variable
MAX_POSTS=3 - Post Delay: Via environment variable
POST_DELAY_SECONDS=3600
Make sure TEST_MODE = True in bot.py:
python bot.pyYou should see:
- ✅ GitHub activity detected
- ✅ Posts generated with AI
- ✅ Images fetched
- ✅ Preview saved to
last_generated_post.txt - ✅ Nothing posted to LinkedIn
# Windows
type last_generated_post.txt
# macOS/Linux
cat last_generated_post.txtCheck if the posts:
- ✅ Match your voice
- ✅ Have relevant content
- ✅ Include proper hashtags
- ✅ Are engaging and professional
In bot.py, change line 535:
TEST_MODE = False # Live mode!python bot.pyYour posts will now go live on LinkedIn! 🎉
git init
git add .
git commit -m "Initial commit"
git remote add origin <your-repo-url>
git push -u origin mainIn your GitHub repository:
- Go to Settings → Secrets and variables → Actions
- Click "New repository secret" for each:
| Secret Name | Value |
|---|---|
LINKEDIN_ACCESS_TOKEN |
Your LinkedIn access token |
LINKEDIN_USER_URN |
Your LinkedIn user URN |
GROQ_API_KEY |
Your Groq API key |
UNSPLASH_ACCESS_KEY |
Your Unsplash key (optional) |
MY_GITHUB_USERNAME |
Your GitHub username |
MY_GITHUB_TOKEN |
Your GitHub token (optional) |
The workflow file .github/workflows/daily-post.yml is already configured!
- Runs daily at 9:00 AM UTC
- Posts up to 3 activities per run
- 1 hour delay between posts
Go to Actions tab → Daily LinkedIn Post → Run workflow
Your bot is now ready to:
- ✅ Detect your GitHub activities
- ✅ Generate AI-powered LinkedIn posts
- ✅ Add relevant images
- ✅ Post automatically on schedule
Error: "Invalid client" or "Authentication failed"
Solutions:
- Double-check
LINKEDIN_CLIENT_IDandLINKEDIN_CLIENT_SECRET - Verify redirect URI is exactly:
http://localhost:8000/callback - Ensure
w_member_socialpermission is granted - Try generating a new access token with
python auth.py
Solutions:
- Check
GITHUB_USERNAMEis correct - Make sure you have public activity in the last 24 hours
- Add a
GITHUB_TOKENfor better API access - Try making a commit or push to trigger activity
Error: "API key invalid" or "Rate limit exceeded"
Solutions:
- Verify
GROQ_API_KEYis correct - Check your usage at Groq Console
- Free tier: 30 requests/min - bot respects this
- Wait a minute and try again
Solutions:
- Check
UNSPLASH_ACCESS_KEYis set - Verify your Unsplash app is approved
- Images are optional - bot works without them
- Check rate limits (50 req/hour on free tier)
Solutions:
- Customize
LINKEDIN_PERSONAinservices/ai_service.py - Adjust temperature in AI settings (higher = more creative)
- Review generated posts in
last_generated_post.txt - Test in
TEST_MODEbefore going live
Solutions:
- Check all secrets are added correctly
- Verify workflow file is in
.github/workflows/ - Check Actions tab for error messages
- Make sure GitHub Actions is enabled for your repo
- Review workflow logs for specific errors
- LinkedIn API Docs: https://learn.microsoft.com/en-us/linkedin/shared/api-reference/api-reference
- Groq Documentation: https://console.groq.com/docs
- GitHub API Docs: https://docs.github.com/en/rest
- Unsplash API: https://unsplash.com/documentation
- ✅ Never commit
.env- It's in.gitignore - ✅ Use GitHub Secrets for automation
- ✅ Regenerate tokens if exposed
- ✅ Rotate credentials periodically
- ✅ Use environment variables in production
- ✅ Keep dependencies updated
- ✅ Review permissions granted to LinkedIn app
- Start with TEST_MODE - Always preview before posting
- Customize the persona - Make it sound like YOU
- Monitor engagement - Adjust based on what works
- Use hashtags wisely - 8-12 relevant tags per post
- Enable images - They get 2-3x better engagement
- Set MAX_POSTS=3 - Don't overwhelm your network
- Check generated posts - Review
last_generated_post.txt - Space out posts - Use
POST_DELAY_SECONDS
If you encounter issues:
- Check the troubleshooting section above
- Review error messages carefully
- Verify all credentials are correct
- Check API rate limits
- Look at
last_generated_post.txtfor clues
Happy Posting! 🚀
Built with ❤️ for developers who code more than they post!