| name | 2x-post-linkedin |
| description | Posts content to LinkedIn via browser automation. Reads local draft, posts, calls publish-draft. |
| user-invocable | false |
2X Post to LinkedIn
Post a draft to LinkedIn via browser. Read local file, post, record via client.
Inputs
- session_number: which session folder to read from
Step 1: Read Draft
cat ~/.openclaw/workspace/2x-sessions/{session_number}/drafts/linkedin.md
If file doesn't exist, stop: "No LinkedIn draft found."
Step 2: Post via Browser
browser open "https://www.linkedin.com/feed/"
- Wait 3 seconds
browser snapshot --interactive
- Find "Start a post" button or text area ā click
- Wait 2 seconds for modal
browser snapshot --interactive
LinkedIn uses a contenteditable div, NOT a regular input.
- Find text area in modal (contenteditable div, role "textbox")
browser type <ref> "{content}"
- Wait 1 second
If browser type fails (content doesn't appear), fallback:
browser evaluate "document.querySelector('div[contenteditable=true].ql-editor, div[role=textbox][contenteditable=true]').innerText = `{content}`; document.querySelector('div[contenteditable=true].ql-editor, div[role=textbox][contenteditable=true]').dispatchEvent(new Event('input', {bubbles: true}))"
browser snapshot --interactive ā verify content visible
- Find "Post" button (blue, bottom of modal)
browser click <ref>
- Wait 3 seconds
browser snapshot ā verify modal closed
Extract Posted URL
LinkedIn doesn't redirect to the post. To find it:
browser open "https://www.linkedin.com/feed/"
- Wait 3 seconds, snapshot
- Find most recent post at top of feed
- URL format:
https://www.linkedin.com/feed/update/urn:li:activity:{id}/
- Extract activity ID as platform_post_id
If extraction fails, report success without URL ā not critical.
Step 3: Record
SESSION_UUID=$(cat ~/.openclaw/workspace/2x-sessions/{session_number}/.supabase_session_id)
node ~/.openclaw/workspace/skills/2x/db/client.js publish-draft \
--session "$SESSION_UUID" \
--platform linkedin \
--platform-post-id "{extracted_id_or_null}" \
--posted-url "{extracted_url_or_null}"
Local log:
echo '{"platform":"linkedin","post_id":"{id}","url":"{url}","posted_at":"'$(date -u +%Y-%m-%dT%H:%M:%SZ)'","session":{session_number}}' \
>> ~/.openclaw/workspace/2x-posted.jsonl
Step 4: Return
ā
Posted to LinkedIn: {url}
Or: ā LinkedIn posting failed: {reason}
Known Gotchas
- "Add to your post" overlay: Ignore ā just find the Post button.
- Modal states: Snapshot after each action.
- Visibility selector: Leave as default ("Anyone"), proceed.
- Rich text paste: LinkedIn may auto-format URLs. Fine ā don't fight it.
- NEVER retry automatically.