An autonomous, self-learning LinkedIn content pipeline. It automatically scrapes marketing news, intelligently filters for high-quality Indian startup / D2C brand content, generates drafts using Groq's Llama 3.3 model, and publishes them. Crucially, it keeps you in the loop via Slack at every key decision point—and utilizes an analytics feedback loop to continuously improve its own writing style.
The core logic is powered by a stateful LangGraph machine with deliberate Human-In-The-Loop (HITL) pauses handled via Slack Bolt Socket Mode.
graph TD
A[Research Node: RSS/HTML Scrape + AI Relevance Filter] --> B(Pick Node: Send options to Slack)
B -->|User selects & inputs opinion| C[Draft Node: Groq Llama 3 drafts hooks & body]
C --> D(Hook Node: Send 3 hook options to Slack)
D -->|User selects hook| E[Finalize Node: Assemble post]
E --> F(Approval Node: Send Final Draft to Slack)
F -->|Rewrite Request| G[Rewrite Node: Groq rewrites post]
G --> F
F -->|Approve & Post| H[Publish Node: Push to LinkedIn API]
This repository also contains analyze.py—a standalone analytics evaluation tool. You paste your past LinkedIn post metrics, and the model structurally identifies what format, length, and hooks caused high (or low) engagement. These insights are saved to data/insights.json (the bot's Long Term Memory) and are automatically injected into the Draft Node for all future posts.
python -m venv venv
.\venv\Scripts\Activate.ps1
pip install -r requirements.txtCreate a .env file in the root directory.
# Groq LLM API Key (Visit console.groq.com)
GROQ_API_KEY=gsk_your_key_here
# Slack Integrations (Create an app at api.slack.com/apps)
SLACK_BOT_TOKEN=xoxb-your-bot-token
SLACK_APP_TOKEN=xapp-your-app-token
SLACK_CHANNEL_ID=C0XXXXXXXXX
# LinkedIn API (OAuth 2.0 Token with w_member_social scopes)
LINKEDIN_ACCESS_TOKEN=AQVI_your_long_token
LINKEDIN_AUTHOR_URN=8lPHe5iTPxTo get the Slack tokens:
- Go to https://api.slack.com/apps → Create New App.
- Add Bot Token Scopes:
chat:write,commands,im:history. - Enable Socket Mode and generate the App-Level token (
xapp-). - Install to your workspace and grab the User OAuth Token (
xoxb-). - Invite the bot to your channel (
/invite @BotName).
We bypass the need for a web-backend by generating a 60-day token directly from LinkedIn's dev portal:
- Go to https://www.linkedin.com/developers/ and create an App.
- In the "Products" tab, request Share on LinkedIn and Sign In with OpenID Connect.
- Go to Docs > Tools > OAuth 2.0 Tools.
- Create a token and check the
w_member_socialandprofilescopes. - Save the token string to the
.env. - To find your URN (Member ID), just run:
python -c "import requests, os; from dotenv import load_dotenv; load_dotenv(); print(requests.get('https://api.linkedin.com/v2/me', headers={'Authorization': 'Bearer ' + os.environ.get('LINKEDIN_ACCESS_TOKEN')}).json().get('id'))"
Execute the main application to start the server:
python main.pyThe bot will immediately scrape top marketing sites, filter them with Groq, and ping your Slack channel with options.
Once a week, evaluate your past posts:
python analyze.pyPaste your post copy and its metrics. The bot will automatically update data/insights.json, and your subsequent runs of main.py will autonomously adapt to your audience's preferences!