LinkedIn Automation Enhanced
/install linkedin-automation-enhanced
LinkedIn Automator
Automate your LinkedIn presence: post content, track engagement, generate ideas, and grow your audience.
Prerequisites
- Browser tool enabled in OpenClaw
- LinkedIn logged in via browser (use profile with LinkedIn session)
Browser Cleanup Requirement
CRITICAL: All scripts that use openclaw browser commands MUST clean up tabs after execution to prevent accumulation.
Updated Pattern (Selective Cleanup - Baseline Comparison)
This pattern preserves pre-existing tabs and only closes tabs opened during script execution:
# Global variable to store baseline tabs
BASELINE_TABS=""
# Capture baseline BEFORE any browser actions
capture_baseline_tabs() {
BASELINE_TABS=$(openclaw browser tabs 2>/dev/null | grep -oE '\[t[0-9]+' | sed 's/\[//g' | sort -u || echo "")
}
# Cleanup function - closes ONLY tabs opened during script execution
cleanup_browser_tabs() {
CURRENT_TABS=$(openclaw browser tabs 2>/dev/null | grep -oE '\[t[0-9]+' | sed 's/\[//g' | sort -u || echo "")
# Find NEW tabs (not in baseline)
NEW_TABS=$(comm -13 \x3C(echo "$BASELINE_TABS") \x3C(echo "$CURRENT_TABS") 2>/dev/null || echo "")
# Close only new tabs
echo "$NEW_TABS" | while read TAB_ID; do
[[ -n "$TAB_ID" ]] && openclaw browser close "$TAB_ID" 2>/dev/null || true
done
}
# Capture baseline immediately (before first browser command)
capture_baseline_tabs
# Set EXIT trap for cleanup (runs on success or failure)
trap cleanup_browser_tabs EXIT
Benefits of this approach:
- ✅ Preserves pre-existing tabs from other concurrent processes
- ✅ Automatically handles auxiliary tabs (reCAPTCHA, blob URLs, etc.)
- ✅ Works even if script fails mid-execution (EXIT trap)
- ✅ No need to track individual tab IDs
Legacy Pattern (Label-Based - Still Valid for Simple Cases)
# 1. Label tabs when opening
openclaw browser open --label "my-tab-label" https://...
# 2. Set EXIT trap for cleanup
cleanup_browser_tabs() {
TABS=$(openclaw browser tabs 2>/dev/null || echo "")
TAB_ID=$(echo "$TABS" | grep "my-tab-label" | head -1 | sed -n 's/.*\[\(t[0-9]*\).*/\1/p')
[[ -n "$TAB_ID" ]] && openclaw browser close "$TAB_ID"
}
trap cleanup_browser_tabs EXIT
Use label-based pattern when:
- Script is simple (1-2 tabs)
- No concurrent browser usage expected
- Don't need to handle auxiliary tabs
Pattern for Agent Execution
# After completing browser workflow:
# Find tab by label and close with short ID (e.g., t74)
openclaw browser tabs | grep "my-tab-label" | sed -n 's/.*\[\(t[0-9]*\).*/\1/p' | xargs -I {} openclaw browser close {}
Verify No Accumulation
openclaw browser tabs # Check tab count before/after runs
Reference Implementation
See scripts/analytics-extract.sh for a complete example with:
- Baseline capture before first browser command
- Re-capture after browser auto-start (if needed)
- Selective cleanup preserving pre-existing tabs
- Logging and verification
Quick Commands
# Post content (feed post, up to 3,000 chars)
{baseDir}/scripts/post.sh "Your post content here"
# Post with image
{baseDir}/scripts/post.sh "Content" --image /path/to/image.png
# Publish native article (long-form, up to 120,000 words, Google-indexed)
{baseDir}/scripts/article.sh --title "Title" --subtitle "Subtitle" --content "Content" [--cover-image /path/to/image]
# Get engagement stats for recent posts
{baseDir}/scripts/analytics.sh
# Generate content ideas based on trending topics
{baseDir}/scripts/ideas.sh [topic]
# Engage with feed (like/comment on relevant posts)
{baseDir}/scripts/engage.sh --limit 10
Workflows
Posting Content (Feed Posts)
Use browser automation to post:
- Navigate to linkedin.com/feed
- Click "Start a post" button
- Enter content in the post editor
- Optionally attach media
- Click "Post" button
For scheduled posts, use OpenClaw cron:
cron add --schedule "0 9 * * 1-5" --payload "Post my LinkedIn content: [content]"
Publishing Articles (Native Long-Form)
Use browser automation to publish articles (up to 120,000 words, searchable on Google):
- Navigate to linkedin.com/feed
- Click "Write article" button (top of feed, near "Start a post")
- In the article editor:
- Enter title
- Enter subtitle (optional)
- Write content with rich formatting (H1/H2, bold, lists, images, embeds)
- Upload cover image (optional)
- Click "Publish" button
- Article appears in your Activity section permanently
Article vs Post:
| Feature | Post | Article |
|---|---|---|
| Length | 1,200-3,000 chars | 120,000 words |
| Google-indexed | ❌ No | ✅ Yes |
| Lifespan | 24-72 hours | Permanent |
| Editor | Simple | Rich (H1-H6, images, embeds) |
| Location | Feed | Activity section |
Content Strategy
See references/content-strategy.md for:
- High-engagement post formats
- Best posting times by region
- Hashtag strategies
- Hook templates
Engagement Automation
See references/engagement.md for:
- Comment templates
- Engagement workflows
- Growth tactics
Analytics Tracking
The analytics script extracts:
- Impressions per post
- Engagement rate (likes + comments + shares / impressions)
- Profile views trend
- Follower growth
- Top performing content themes
Browser Selectors
Key LinkedIn selectors (as of 2026):
# Posts
Post button: button[aria-label="Start a post"]
Post editor: div.ql-editor[data-placeholder]
Submit post: button.share-actions__primary-action
# Articles
Write article button: button containing "Write article" (top of feed)
Article title: input[placeholder*="title"] or h1[contenteditable]
Article body: div[contenteditable="true"] or div.editor-content
Publish button: button containing "Publish"
# General
Like button: button[aria-label*="Like"]
Comment button: button[aria-label*="Comment"]
Profile stats: section.pv-top-card-v2-ctas
Rate Limits
LinkedIn enforces activity limits. Stay under:
- Posts: 2-3 per day max
- Articles: 1-2 per day recommended
- Comments: 20-30 per day
- Connection requests: 100 per week
- Profile views: Natural browsing pace
Troubleshooting
- Login required: Ensure browser profile has active LinkedIn session
- Rate limited: Reduce activity, wait 24h
- Selector not found: LinkedIn may have updated UI, check selectors
- Article editor not loading: Try desktop browser (mobile has limited editor support)
- Tabs accumulating: Scripts use selective cleanup (baseline comparison). If tabs remain:
# Verify cleanup trap exists in script grep "trap cleanup" scripts/analytics-extract.sh # Check what the script considers "new tabs" (debug) # Run this DURING script execution to see baseline vs current # Manually close LinkedIn-related tabs if needed (use short tab IDs like t74) openclaw browser tabs | grep linkedin.com | sed -n 's/.*\[\(t[0-9]*\).*/\1/p' | \ while read tab; do openclaw browser close "$tab"; done - Zombie tabs after script run: Script may have crashed before cleanup, OR tabs were pre-existing (preserved by design). Verify:
# Check if tabs were pre-existing (not script-created) openclaw browser tabs # If truly zombie tabs, close by label pattern openclaw browser tabs | grep "linkedin-analytics-tab" | sed -n 's/.*\[\(t[0-9]*\).*/\1/p' | xargs -I {} openclaw browser close {} openclaw browser tabs | grep "linkedin-activity-tab" | sed -n 's/.*\[\(t[0-9]*\).*/\1/p' | xargs -I {} openclaw browser close {} # Nuclear option: Close ALL tabs (use with caution - closes pre-existing too) openclaw browser tabs | grep -oE '\[t[0-9]+' | sed 's/\[//g' | while read tab; do openclaw browser close "$tab"; done - Browser unresponsive: Restart browser (nuclear option):
openclaw browser stop openclaw browser start
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install linkedin-automation-enhanced - 安装完成后,直接呼叫该 Skill 的名称或使用
/linkedin-automation-enhanced触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
LinkedIn Automation Enhanced 是什么?
Automate LinkedIn content creation, posting, engagement tracking, and audience growth. Use for posting content, scheduling posts, analyzing engagement metric... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 72 次。
如何安装 LinkedIn Automation Enhanced?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install linkedin-automation-enhanced」即可一键安装,无需额外配置。
LinkedIn Automation Enhanced 是免费的吗?
是的,LinkedIn Automation Enhanced 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
LinkedIn Automation Enhanced 支持哪些平台?
LinkedIn Automation Enhanced 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 LinkedIn Automation Enhanced?
由 Renato Maluhy Bellan(@renatomaluhy)开发并维护,当前版本 v1.0.0。