Skip to content

About

A production-ready **Chrome Extension (Manifest V3)** that injects an AI-powered "AI Comment" button into every LinkedIn post, letting you generate high-quality comments in one click — no copy-pasting required.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

💬 LinkedIn AI Comment Generator

A production-ready Chrome Extension (Manifest V3) that injects an AI-powered "AI Comment" button into every LinkedIn post, letting you generate high-quality comments in one click — no copy-pasting required.


✨ Features

Feature Details
🎯 One-click generation Button appears below every LinkedIn post
🎭 4 Tone modes Professional · Insightful · Contrarian · Witty
🔄 Regenerate Don't like it? Try again instantly
📋 Copy button Copy comment text to clipboard
🔐 Secure key storage API key stored only in chrome.storage.local
♾️ SPA-aware MutationObserver handles LinkedIn's infinite scroll
⚡ Fast Uses gpt-4o-mini for sub-second responses

📁 File Structure

linkedin_comment_extension/
├── manifest.json      # MV3 config, permissions, host rules
├── background.js      # Service worker — all OpenAI API calls happen here
├── content.js         # DOM injection, MutationObserver, button logic
├── styles.css         # LinkedIn-native UI styling
├── popup.html         # Extension popup — key setup & tone picker
├── popup.js           # Popup logic — save/load settings
└── icons/
    ├── icon16.png
    ├── icon32.png
    ├── icon48.png
    └── icon128.png

🚀 Installation

Step 1 — Load the extension in Chrome

  1. Open Chrome and go to: chrome://extensions
  2. Enable Developer mode (toggle in top-right)
  3. Click "Load unpacked"
  4. Select the linkedin_comment_extension/ folder
  5. The extension icon should appear in your toolbar

Step 2 — Add your OpenAI API Key

  1. Click the extension icon (💬) in the Chrome toolbar
  2. Paste your OpenAI API key (sk-…) into the input field
  3. Click Save API Key
  4. The status banner will turn green: "API key active"

Get a key at platform.openai.com/api-keys

Step 3 — Use on LinkedIn

  1. Go to linkedin.com/feed
  2. Look for the 💬 AI Comment button below each post
  3. (Optional) Choose a tone pill — Professional / Insightful / Contrarian / Witty
  4. Click AI Comment — the generated text will appear in the comment box
  5. Review it, edit if you like, and click Post

🎭 Tone Guide

Tone Behavior
Professional Credible, measured, industry-expert voice
Insightful Connects non-obvious dots, adds real value
Contrarian Respectfully challenges assumptions
Witty Sharp, clever one-liner with substance

Tone can be changed:

  • Per post — using the inline tone pills beneath each post
  • As default — via the popup Settings → Default Tone

🔐 Security

  • API key is stored exclusively in chrome.storage.local (device-local, never synced)
  • All OpenAI calls happen in the background service worker — the content script never touches the raw key
  • No data is sent anywhere except directly to api.openai.com

⚙️ How It Works

User clicks "AI Comment"
        │
        ▼
content.js extracts post text
        │
        ▼
Sends message to background.js
        │
        ▼
background.js fetches API key from storage
        │
        ▼
Calls OpenAI gpt-4o-mini with tone-specific prompt
        │
        ▼
Returns generated comment to content.js
        │
        ▼
Inserted into LinkedIn's contenteditable comment box

🧩 Edge Cases Handled

  • Image-only posts → graceful fallback, shows toast
  • "See more" posts → reads expanded inner text
  • Comment box not open → tries clicking LinkedIn's comment button
  • No comment box found → copies to clipboard + toast notification
  • API failure → error toast with message
  • API key missing → descriptive error pointing to popup
  • Duplicate injection → data-ai-comment-injected guard attribute
  • SPA navigation → MutationObserver reinjects on new posts

🛠️ Development

To iterate on the extension:

  1. Make changes to any file
  2. Go to chrome://extensions
  3. Click the refresh icon on the extension card
  4. Reload the LinkedIn tab

📝 Notes

  • The extension uses gpt-4o-mini — fast and cost-effective (~$0.0002/comment)
  • Comments are capped at 200 tokens to stay concise
  • Temperature is set to 0.8 for natural variation per regeneration

About

A production-ready **Chrome Extension (Manifest V3)** that injects an AI-powered "AI Comment" button into every LinkedIn post, letting you generate high-quality comments in one click — no copy-pasting required.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages