X/Twitter messaging management via API. Read tweets, post tweets, reply, send DMs, search, and view analytics. Use when the user wants to interact with X/Twitter: (1) posting or scheduling tweets, (2) reading timeline/mentions/DMs, (3) replying to tweets, (4) searching tweets/users/hashtags, (5) checking engagement analytics. Requires Twitter API credentials (API key, API secret, access token, access secret) or Bearer token.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/klemenska/twitter-x-apiTwitter/X API Skill
Interact with X (Twitter) via API v2 for reading, posting, replying, DMs, search, and analytics.
Setup
Credentials
Store credentials in environment variables or ~/.config/twitter/credentials.json:
export TWITTER_API_KEY="your-api-key"
export TWITTER_API_SECRET="your-api-secret"
export TWITTER_ACCESS_TOKEN="your-access-token"
export TWITTER_ACCESS_SECRET="your-access-secret"
export TWITTER_BEARER_TOKEN="your-bearer-token" # For read-only operations
Or create credentials file:
mkdir -p ~/.config/twitter
cat > ~/.config/twitter/credentials.json << 'EOF'
{
"api_key": "your-api-key",
"api_secret": "your-api-secret",
"access_token": "your-access-token",
"access_secret": "your-access-secret",
"bearer_token": "your-bearer-token"
}
EOF
chmod 600 ~/.config/twitter/credentials.json
Install Dependencies
pip install tweepy
Quick Reference
| Task | Command |
|---|---|
| Post tweet | {baseDir}/scripts/tweet.py post "text" |
| Post with image | {baseDir}/scripts/tweet.py post "text" --media image.png |
| Reply | {baseDir}/scripts/tweet.py reply TWEET_ID "text" |
| Thread | {baseDir}/scripts/tweet.py thread "tweet1" "tweet2" ... |
| Get timeline | {baseDir}/scripts/tweet.py timeline [--count 20] |
| Get mentions | {baseDir}/scripts/tweet.py mentions [--count 20] |
| Get DMs | {baseDir}/scripts/tweet.py dms [--count 20] |
| Send DM | {baseDir}/scripts/tweet.py dm USERNAME "message" |
| Search | {baseDir}/scripts/tweet.py search "query" [--count 20] |
| User info | {baseDir}/scripts/tweet.py user USERNAME |
| Tweet info | {baseDir}/scripts/tweet.py show TWEET_ID |
| Analytics | {baseDir}/scripts/tweet.py analytics TWEET_ID |
Scripts
tweet.py
Main script for all Twitter operations. Run with --help for details:
{baseDir}/scripts/tweet.py --help
{baseDir}/scripts/tweet.py post --help
Common Workflows
Post a simple tweet:
{baseDir}/scripts/tweet.py post "Hello, world!"
Post with image:
{baseDir}/scripts/tweet.py post "Check this out!" --media photo.png
{baseDir}/scripts/tweet.py post "Multiple images" --media img1.png --media img2.png
Reply to a tweet:
{baseDir}/scripts/tweet.py reply 1234567890 "Great point!"
Post a thread:
{baseDir}/scripts/tweet.py thread \
"First tweet in thread" \
"Second tweet" \
"Third tweet"
Read your mentions:
{baseDir}/scripts/tweet.py mentions --count 50
Search for tweets:
{baseDir}/scripts/tweet.py search "openclaw agent" --count 20
{baseDir}/scripts/tweet.py search "#AI lang:en" --count 20
Get user info:
{baseDir}/scripts/tweet.py user elonmusk
Send a DM:
{baseDir}/scripts/tweet.py dm username "Hello from OpenClaw!"
View tweet analytics:
{baseDir}/scripts/tweet.py analytics 1234567890
API Tiers & Limits
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-klemenska-twitter-x-api": {
"enabled": true,
"auto_update": true
}
}
}