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.
| 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 |
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
- Open Chrome and go to:
chrome://extensions - Enable Developer mode (toggle in top-right)
- Click "Load unpacked"
- Select the
linkedin_comment_extension/folder - The extension icon should appear in your toolbar
- Click the extension icon (💬) in the Chrome toolbar
- Paste your OpenAI API key (
sk-…) into the input field - Click Save API Key
- The status banner will turn green: "API key active"
Get a key at platform.openai.com/api-keys
- Go to linkedin.com/feed
- Look for the 💬 AI Comment button below each post
- (Optional) Choose a tone pill — Professional / Insightful / Contrarian / Witty
- Click AI Comment — the generated text will appear in the comment box
- Review it, edit if you like, and click Post
| 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
- 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
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
- 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-injectedguard attribute - SPA navigation → MutationObserver reinjects on new posts
To iterate on the extension:
- Make changes to any file
- Go to
chrome://extensions - Click the refresh icon on the extension card
- Reload the LinkedIn tab
- 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.8for natural variation per regeneration