AI-powered Chrome extension that generates comments and replies on Facebook group posts using Claude API. Operates through a Side Panel alongside the Facebook tab.
- Open
chrome://extensions/ - Enable Developer mode (top-right toggle)
- Click Load unpacked
- Select this folder
- Click the extension icon to open the Side Panel
- Click the gear icon (top-right) to open Settings
- Fill in:
- API Key: Your API key from any Claude-compatible provider (Anthropic, OpenRouter, etc.)
- API Base URL: The API endpoint, e.g.
https://api.anthropic.com/v1 - Model: The Claude model name, e.g.
claude-sonnet-4-20250514 - Group URL: The Facebook group to target, e.g.
https://www.facebook.com/groups/aiartworksvn
- Click Done to save
- Open the Facebook group in a Chrome tab
- Open the Side Panel (click extension icon)
- Click Scan Group Posts to find posts
- Click a post to navigate to its permalink and load all comments
- Click Generate to get AI-suggested comments
- Pick a suggestion (or edit), then click Post Comment
- For replies: find a comment, click Generate Reply, pick/edit, click Reply
┌──────────────┐ chrome.runtime ┌─────────────────┐
│ Side Panel │ ◄──── messages ──────► │ Service Worker │
│ panel.html │ │ service-worker.js│
│ panel.js │ │ ├─ claude-api │
│ panel.css │ │ ├─ storage │
└──────────────┘ │ └─ cooldown │
└───────┬─────────┘
│ chrome.tabs
│ .sendMessage
┌───────▼─────────┐
│ Content Script │
│ content.js │
│ ├─ feed scanner│
│ ├─ permalink │
│ ├─ poster │
│ └─ selectors │
└─────────────────┘
| Path | Purpose |
|---|---|
manifest.json |
Chrome extension manifest (Manifest V3) |
background/service-worker.js |
Message router, tab navigation, AI dispatch |
background/claude-api.js |
API wrapper using Anthropic Messages format |
background/storage.js |
Chrome storage helpers (config + state) |
background/cooldown.js |
Rate limiting (cooldown disabled by default) |
content/content.js |
Single content script: feed scanner, permalink scanner, comment poster |
sidepanel/panel.html |
Side panel UI structure |
sidepanel/panel.css |
Apple OS-inspired theme |
sidepanel/panel.js |
Side panel logic (views, settings, AI actions) |
icons/ |
Extension icons (16, 48, 128px) |
- Feed scan: Extension auto-scrolls the Facebook group feed, collects posts with text, author, permalink, and engagement stats
- Post detail: Navigates to a post's permalink URL, expands all comments and replies, extracts the full comment tree
- AI generation: Sends post + comment context to the configured API endpoint, returns 2 suggestions
- Posting: Simulates human typing (configurable speed, random typos) into Facebook textboxes, submits with Enter
- Typing simulation: 60–180ms per character using
document.execCommand('insertText') - Random typos: 3% chance of mistype → backspace → correct
- Random pauses: 5% chance of 400–800ms pause; longer after punctuation
- Configurable settings in the Side Panel
The extension uses the Anthropic Messages API format (POST /v1/messages). It works with any provider that exposes a compatible endpoint:
| Provider | API Base URL |
|---|---|
| Anthropic (official) | https://api.anthropic.com/v1 |
| OpenRouter | https://openrouter.ai/api/v1 |
| Any Claude-compatible proxy | Your provider's URL |
Note: The API format is Anthropic-specific (system prompt, messages array, anthropic-version header). It is not compatible with OpenAI Chat Completions format. Make sure your provider supports the Anthropic Messages API.
| Setting | Default | Description |
|---|---|---|
| API Key | (empty) | Your API key |
| API Base URL | (empty) | API endpoint (must be Anthropic Messages-compatible) |
| Model | claude-sonnet-4-6 |
Claude model name |
| Group URL | (empty) | Facebook group to target |
| System Prompt | (see code) | AI personality instructions |
| Daily Limit | 20 | Max comments per day |
| Min Delay | 3 min | Minimum delay between comments |
| Simulate Typing | On | Human-like typing simulation |
| Random Typos | On | Occasional typos with correction |
| Random Skip % | 35% | Posts to skip for natural behavior |
sidePanel— Chrome Side Panel APIstorage— Save config and statetabs/scripting— Content script injection, tab navigationwebNavigation— SPA URL change detection*://www.facebook.com/*— Facebook page access
- The content script is a single file (
content/content.js) that survives SPA navigation. No re-injection needed. - Page type detection checks both URL regex and DOM (
[role="feed"]existence). - Facebook is a React SPA —
windowpersists across navigations. A__NGHIEN_AI_V4guard prevents double-initialization. - The feed scanner uses a slot-based approach: iterates
[role="feed"]children that contain permalink links, rather than depending on[role="article"]elements. - All DOM interaction follows ACTION → WAIT → VERIFY pattern.
MIT