X API Publisher
Use this skill for API-based X/Twitter operations with the local credential file.
Files
- Script:
${SKILL_DIR}/scripts/x_post.py - Credential file:
~/clawd/scripts/data/x_fusheng_keys.json
Do not print secrets back into chat.
Supported actions
###1) Verify credentials Safe to run without extra confirmation:
python3 ${SKILL_DIR}/scripts/x_post.py check
###2) Post a single tweet Only publish after the user has explicitly confirmed the post.
python3 ${SKILL_DIR}/scripts/x_post.py post "你的推文内容"
###3) Post a thread
Use || as the separator between tweets.
python3 ${SKILL_DIR}/scripts/x_post.py thread "第1条||第2条||第3条"
###4) Delete a tweet Deletion is destructive. Confirm with the user first.
python3 ${SKILL_DIR}/scripts/x_post.py delete <tweet_id>
Workflow
- If the user provided new credentials, update
~/clawd/scripts/data/x_fusheng_keys.json. - Run
checkfirst to confirm the account is reachable. - Draft or confirm the tweet/thread text.
- Only after explicit approval, run
postorthread. - Return the final tweet URL or error message.
Credential format
Expected JSON fields:
{
"consumer_key": "...",
"consumer_secret": "...",
"access_token": "...",
"access_token_secret": "...",
"bearer_token": "..."
}
Troubleshooting
###403 oauth1-permissions The X app is missing write permissions.
Fix:
- Set the X app to Read and write
- Regenerate Access Token and Access Token Secret
- Update the credential JSON
###402 CreditsDepleted The X API account has no usable credits.
Fix:
- Top up X API credits in the X Developer Console
- Retry the same command after credits are available
Client Secret only / OAuth2-only credentials
A Client Secret alone is not enough for this OAuth1 posting flow. You still need user-scoped posting credentials, or a complete OAuth2 user-token flow.
Notes
- This skill is for API publishing, not browser automation.
- If API posting is blocked by credits or permissions, explain the exact blocker clearly.
- After a successful post, always return the URL.