Install
openclaw skills install x-twitter-browserLog in to X/Twitter via a real browser session and perform actions — posting, replying, reposting, liking, and bookmarking tweets via headless Playwright.
openclaw skills install x-twitter-browserExecute browser actions on X using a saved login session, without the official X API.
Users log in once via a visible browser window. The session is saved and reused for all subsequent headless operations.
After installing into OpenClaw, the skill lives at:
~/.openclaw/workspace/skills/x-twitter-browser/
Commands below assume you run from the skill root directory:
cd ~/.openclaw/workspace/skills/x-twitter-browser
This skill has two layers:
Manages login and cookie persistence (stored in the centralised OpenClaw auth directory):
scripts/setup_session.py — log in via visible browser, save cookies~/.openclaw/auth/x-twitter/cookies.json — Playwright storage statePerforms actions using the saved session:
scripts/post_tweet.pyscripts/reply_post.pyscripts/repost_post.pyscripts/like_post.pyscripts/bookmark_post.pyFirst-time setup (installs Playwright + Chromium):
./scripts/setup.sh
Note: Chromium download is ~150MB and may take several minutes on first run.
OpenClaw: When running setup.sh via OpenClaw, it executes in the background and the user cannot see the echo output. Forward each progress message to the user so they know the setup is progressing.
Session cookies are stored in ~/.openclaw/auth/x-twitter/cookies.json (centralised auth directory shared by all OpenClaw skills, survives skill updates). Do not commit or share this file.
This is a two-phase process. You (the agent) drive both phases — the user does not need to touch the terminal.
Phase 1 — Launch the login browser:
python3 scripts/setup_session.py
This opens a visible browser window at the X login page. The script prints a banner and waits for Enter on stdin before saving cookies. Once the browser is open, tell the user:
A browser window has opened with the X login page. Please log in with your account (username, password, 2FA if prompted). Once you see the home timeline, let me know.
Then wait for the user to confirm they have logged in. Do NOT send Enter yet.
Phase 2 — After the user confirms they are logged in:
Send Enter (newline) to the waiting script's stdin to trigger cookie saving. Check the output for Session saved to confirm success.
If the output shows a WARNING ("The page still looks like a login page"), ask the user to double-check they are actually logged in and can see the home timeline. Once confirmed, send Enter again to save anyway.
python3 scripts/setup_session.py --verify-only
Success looks like:
Session looks valid: https://x.com/home
If verification fails, re-run the two-phase login flow above.
If running on a headless VM, set up the session on a local machine first, then copy:
scp ~/.openclaw/auth/x-twitter/cookies.json user@server:~/.openclaw/auth/x-twitter/cookies.json
Follow the two-phase login flow in the "Session management" section above. Do not simply run setup_session.py and tell the user to press Enter — you must run it, wait for the user to confirm login, then send Enter yourself.
python3 scripts/post_tweet.py \
--text "hello"
python3 scripts/reply_post.py \
--tweet "https://x.com/username/status/123456789" \
--text "My reply"
Plain repost (no comment):
python3 scripts/repost_post.py \
--tweet "https://x.com/username/status/123456789"
Quote tweet (repost with your comment):
python3 scripts/repost_post.py \
--tweet "https://x.com/username/status/123456789" \
--text "My comment"
For both reply and repost, --tweet accepts a full URL or just the tweet ID.
python3 scripts/like_post.py \
--tweet "https://x.com/username/status/123456789"
Unlike (remove like):
python3 scripts/like_post.py \
--tweet "https://x.com/username/status/123456789" \
--undo
python3 scripts/bookmark_post.py \
--tweet "https://x.com/username/status/123456789"
Remove bookmark:
python3 scripts/bookmark_post.py \
--tweet "https://x.com/username/status/123456789" \
--undo
For like and bookmark, --tweet accepts a full URL or just the tweet ID.
--verify-only success means the session is likely usablesetup_session.py./scripts/setup.sh to install browser deps--verify-only before any write operation~/.openclaw/auth/)scripts/*.py directlyNo saved session. Run setup_session.py first to log in to X.No cookies found at ~/.openclaw/auth/x-twitter/cookies.json. Run the two-phase login flow (see "Session management" above).
Session is not authenticatedRe-run the two-phase login flow to log in again.