Skip to main content

OpenClaw X/Twitter skill — full-featured CLI for X API v2

Project description

openclaw-x

Full-featured CLI and OpenClaw skill for X/Twitter API v2.

Features

  • Tweet operations: post, get, delete, reply, quote, search, metrics
  • Media upload: JPG, PNG, WEBP, GIF, MP4 via chunked upload (no tweepy)
  • Threads: create, continue, name, and track threaded conversations
  • User operations: lookup, timeline, followers, following
  • Engagement: like, retweet, bookmark
  • Self operations: mentions, bookmarks
  • History: local tracking of all posted tweets and threads
  • Multiple output formats: JSON, human-readable (rich), TSV, Markdown
  • OpenClaw integration: ready-to-use skill definition and agent templates

Installation

# With uv (recommended)
uv tool install openclaw-x

# With pip
pip install openclaw-x

Configuration

Set your X API credentials. Get them at developer.x.com.

mkdir -p ~/.config/openclaw-x
cat > ~/.config/openclaw-x/.env << 'EOF'
X_API_KEY=your_api_key
X_API_SECRET=your_api_secret
X_ACCESS_TOKEN=your_access_token
X_ACCESS_TOKEN_SECRET=your_access_token_secret
X_BEARER_TOKEN=your_bearer_token
EOF

Or set environment variables directly / use a .env file in your working directory.

Usage

# Post a tweet
openclaw-x tweet post "Hello from openclaw-x!"

# Post with media
openclaw-x tweet post "Check this out" --media /path/to/image.jpg

# Search tweets (JSON output)
openclaw-x -j tweet search "AI agents" --max 20

# Post a thread
openclaw-x thread post "First tweet" "Second tweet" "Third tweet" --name my-thread

# Continue the thread later
openclaw-x thread continue my-thread "Another tweet in the thread"

# Get a user profile
openclaw-x user get @username

# Like a tweet
openclaw-x like https://x.com/user/status/1234567890

# View your mentions
openclaw-x me mentions

# See tweet history
openclaw-x history

CLI Reference

openclaw-x [-j|--json] [-p|--plain] [-md|--markdown] [-v|--verbose]
├── tweet post TEXT [--media PATH] [--poll OPTIONS]
├── tweet get ID_OR_URL
├── tweet delete ID_OR_URL
├── tweet reply ID_OR_URL TEXT [--media PATH]
├── tweet quote ID_OR_URL TEXT [--media PATH]
├── tweet search QUERY [--max N]
├── tweet metrics ID_OR_URL
├── thread post TEXT... [--name NAME] [--file PATH]
├── thread continue NAME TEXT [--media PATH]
├── thread list
├── thread history NAME
├── user get USERNAME
├── user timeline USERNAME [--max N]
├── user followers USERNAME [--max N]
├── user following USERNAME [--max N]
├── me mentions [--max N]
├── me bookmarks [--max N]
├── me bookmark ID_OR_URL
├── me unbookmark ID_OR_URL
├── like ID_OR_URL
├── retweet ID_OR_URL
├── history [--count N]
└── version

Output Formats

Flag Format Use Case
(default) Rich panels/tables Interactive terminal use
-j JSON Agent consumption, scripting
-p TSV Piping to other tools
-md Markdown Documentation, reports

OpenClaw Integration

Install as an OpenClaw skill:

# The skill definition is in skill/SKILL.md
openclaw skills add openclaw-x /path/to/openclaw-x-skill/skill

Development

git clone https://github.com/AmuMoon/openclaw-x-skill.git
cd openclaw-x-skill
uv sync --group dev
uv run pytest tests/ -v
uv run ruff check src/ tests/

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openclaw_x-0.1.0.tar.gz (29.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openclaw_x-0.1.0-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file openclaw_x-0.1.0.tar.gz.

File metadata

  • Download URL: openclaw_x-0.1.0.tar.gz
  • Upload date:
  • Size: 29.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for openclaw_x-0.1.0.tar.gz
Algorithm Hash digest
SHA256 018371861dbdb98cdaad2e4588fc9b31eac18041df700851b127ac333a0facb9
MD5 022decc61194f73e2d8cea32421f7561
BLAKE2b-256 ecb3fdf8744ab8e7a1ad88b560f035c37af4ac5d1bbd0a990e9ed83e50ec0d41

See more details on using hashes here.

Provenance

The following attestation bundles were made for openclaw_x-0.1.0.tar.gz:

Publisher: release.yml on AmuMoon/openclaw-x-skill

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file openclaw_x-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: openclaw_x-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for openclaw_x-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 695200d132700f73e632ed4c84d153a6d81fe5d534b9d86af64a39e092bcf47f
MD5 bd74d86f90949cb52a6540f4e316f8f3
BLAKE2b-256 e798fccd50c798af8cce1240e4165ca14ddc48d129d6b217561a2d8a052bea9f

See more details on using hashes here.

Provenance

The following attestation bundles were made for openclaw_x-0.1.0-py3-none-any.whl:

Publisher: release.yml on AmuMoon/openclaw-x-skill

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page