Skip to content

Repository files navigation

🤖 LinkedIn AI Auto Poster

Automatically generates and posts trending Android content to your LinkedIn profile.

📖 Full Technical Article

Want to understand how this works in depth?

Read the complete tutorial:

  • 📝 Medium - Original detailed writeup
  • 💻 Dev.to - Developer community version

What's covered:

  • Complete architecture and design decisions
  • Step-by-step API integration (DuckDuckGo, Groq, LinkedIn)
  • Prompt engineering techniques
  • GitHub Actions automation setup
  • Challenges faced and solutions
  • Ethics of automation

🔄 How It Works

📋 Prerequisites

  1. LinkedIn tokens - Run token_gen.py first to authenticate
  2. Groq API key - Free at https://console.groq.com
  3. Python 3.8+

🚀 Quick Start

# Install dependencies
pip install -r requirements.txt
# Test without posting (dry run)
python linkedin_ai_poster.py --dry-run
# Actually post to LinkedIn
python linkedin_ai_poster.py

⚙️ Configuration

Edit the script to customize:

# Search queries for trending topicsSEARCH_QUERIES= [
"Android development trends 2025",
"Kotlin new features latest",
"Jetpack Compose updates",
]
# AI ModelGROQ_MODEL="llama-3.3-70b-versatile"

📅 Weekly Automation (GitHub Actions)

Create .github/workflows/weekly-post.yml:

name: Weekly LinkedIn Poston:
schedule:
- cron: '0 3 * * 3'# Every Wednesday 8:30 AM ISTworkflow_dispatch: # Manual triggerjobs:
post:
runs-on: ubuntu-lateststeps:
- uses: actions/checkout@v3
- name: Setup Pythonuses: actions/setup-python@v4with:
python-version: '3.10'
- name: Install dependenciesrun: pip install -r requirements.txt
- name: Run posterenv:
GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }}LINKEDIN_ACCESS_TOKEN: ${{ secrets.LINKEDIN_ACCESS_TOKEN }}LINKEDIN_PERSON_URN: ${{ secrets.LINKEDIN_PERSON_URN }}run: python linkedin_ai_poster.py

🧪 Dry Run Mode

Test without posting:

python linkedin_ai_poster.py --dry-run
# or
python linkedin_ai_poster.py -d

This will:

  • Search trending topics ✅
  • Pick best topic with AI ✅
  • Generate post content ✅
  • Show preview ✅
  • NOT post to LinkedIn ❌

📁 Project Structure

linkedin_ai_poster/
├── linkedin_ai_poster.py # Main script
├── linkedin_tokens.json # LinkedIn auth tokens
├── post_history.json # History of posted content
├── post_history.json # Genrating initial token
├── requirements.txt # Dependencies
└── README.md # This file

🎯 Customizing the Prompt

The SYSTEM_PROMPT in the script defines your LinkedIn persona. Customize it for your niche:

  • Change expertise areas
  • Update your background
  • Modify tone and style
  • Add/remove hashtags

⚠️ Important Notes

  • LinkedIn tokens expire in ~60 days
  • Don't post too frequently (1-2x per week is ideal)
  • Review AI content before posting in production
  • Groq free tier has rate limits

🐛 Troubleshooting

"No LinkedIn tokens found"
→ Run token_gen.py first to authenticate

"Groq API error"
→ Check your API key is valid

"Search error"
→ DuckDuckGo might be rate-limited, try again later

📚 Learn More

For a deep dive into how this system was built, check out the full articles:

🤝 Contributing

Found a bug? Have an improvement? PRs welcome!

📄 License

MIT License - feel free to use this for your own projects!


Made with ❤️ for building LinkedIn presence on autopilot!

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages