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/Twi...
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install twitter-x-api或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install twitter-x-api⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/twitter-x-api/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: twitter description: "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." ---
Interact with X (Twitter) via API v2 for reading, posting, replying, DMs, search, and analytics.
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
pip install tweepy
| 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 |
Main script for all Twitter operations. Run with --help for details:
{baseDir}/scripts/tweet.py --help
{baseDir}/scripts/tweet.py post --help
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
| Tier | Cost | Read | Write | Search | |------|------|------|-------|--------| | Free | $0 | Limited | - | - | | Basic | $100/mo | 10k/mo | 1.5k/mo | 50/mo | | Pro | $5000/mo | 1M/mo | 300k/mo | 500/mo |
Free tier can only post tweets (no read access to timeline/mentions). Basic tier required for reading mentions, timeline, and search. Write-only operations work on free tier.
See {baseDir}/references/api-limits.md for detailed rate limits.
Common errors:
| Error | Cause | Solution | |-------|-------|----------| | 403 Forbidden | Insufficient tier | Upgrade API tier or check endpoint access | | 429 Too Many Requests | Rate limit hit | Wait and retry; check rate limit headers | | 401 Unauthorized | Invalid credentials | Verify API keys and tokens | | 404 Not Found | Tweet/user deleted | Handle gracefully, inform user | | 422 Unprocessable | Duplicate tweet | Wait before posting same content |
{baseDir}/references/search-operators.md for advanced queries.{baseDir}/scripts/tweet.py - Main CLI for all operations{baseDir}/references/api-limits.md - Detailed rate limits by endpoint{baseDir}/references/search-operators.md - Twitter search syntax安装 Twitter/X API 后,可以对 AI 说这些话来触发它
Help me get started with Twitter/X API
Explains what Twitter/X API does, walks through the setup, and runs a quick demo based on your current project
Use Twitter/X API to x/Twitter messaging management via API
Invokes Twitter/X API with the right parameters and returns the result directly in the conversation
What can I do with Twitter/X API in my marketing & growth workflow?
Lists the top use cases for Twitter/X API, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/twitter-x-api/ 目录(个人级,所有项目可用),或 .claude/skills/twitter-x-api/(项目级)。重启 AI 客户端后,用 /twitter-x-api 主动调用,或让 AI 根据上下文自动发现并使用。
Twitter/X API 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
Twitter/X API 可免费安装使用。请查阅仓库了解许可证信息。
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/Twi...
Twitter/X API 属于「Marketing & Growth」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。
Automate my marketing & growth tasks using Twitter/X API
Identifies repetitive steps in your workflow and sets up Twitter/X API to handle them automatically