Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI LinkedIn Marketing Autobot 🚀

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.


🏗 System Architecture

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]
Loading

The Autonomous "Iterate" Engine (analyze.py)

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.


🛠 Setup & Installation

1. Python Environment

python -m venv venv
.\venv\Scripts\Activate.ps1
pip install -r requirements.txt

2. Configure Environment Variables

Create 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=8lPHe5iTPx

3. Creating the Slack App

To get the Slack tokens:

  1. Go to https://api.slack.com/appsCreate New App.
  2. Add Bot Token Scopes: chat:write, commands, im:history.
  3. Enable Socket Mode and generate the App-Level token (xapp-).
  4. Install to your workspace and grab the User OAuth Token (xoxb-).
  5. Invite the bot to your channel (/invite @BotName).

4. Getting your LinkedIn Auth

We bypass the need for a web-backend by generating a 60-day token directly from LinkedIn's dev portal:

  1. Go to https://www.linkedin.com/developers/ and create an App.
  2. In the "Products" tab, request Share on LinkedIn and Sign In with OpenID Connect.
  3. Go to Docs > Tools > OAuth 2.0 Tools.
  4. Create a token and check the w_member_social and profile scopes.
  5. Save the token string to the .env.
  6. 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'))"

🚀 Usage

1. The Daily Run

Execute the main application to start the server:

python main.py

The bot will immediately scrape top marketing sites, filter them with Groq, and ping your Slack channel with options.

2. The Analytics Feedback Loop

Once a week, evaluate your past posts:

python analyze.py

Paste 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!

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages