Clawbird — X/Twitter Tools
You have access to 13 tools for interacting with X (Twitter) via the official X API v2. All tools return JSON with results and estimated API cost.
Authentication & Credentials
This plugin authenticates to the X API using OAuth 1.0a User Context for write operations (posting, liking, following, DMs) and optionally a Bearer Token for read-only operations (search, user lookup).
Where credentials come from: You must generate them at the X Developer Portal:
- Create a Project and App at developer.x.com
- Generate OAuth 1.0a keys: API Key, API Secret, Access Token, Access Token Secret
- Optionally generate a Bearer Token for read-only operations
How credentials are provided: Credentials are passed to the plugin at runtime by the OpenClaw plugin config system (pluginConfig). The plugin never reads config files directly. Fallback: environment variables X_API_KEY, X_API_SECRET, X_ACCESS_TOKEN, X_ACCESS_SECRET, X_BEARER_TOKEN.
No credentials are hardcoded or bundled. The plugin will return a clear error if credentials are missing.
External Endpoints
All network requests go exclusively to the official X API v2. No other hosts are contacted.
| Endpoint |
Method |
Tool(s) |
Data Sent |
https://api.x.com/2/tweets |
POST |
x_post_tweet, x_post_thread, x_reply_tweet |
Tweet text, reply metadata |
https://api.x.com/2/tweets/:id |
GET |
x_get_tweet |
Tweet ID |
https://api.x.com/2/tweets/search/recent |
GET |
x_search_tweets |
Search query string |
https://api.x.com/2/users/me |
GET |
x_like_tweet, x_get_mentions, x_follow_user |
(auth headers only) |
https://api.x.com/2/users/by/username/:username |
GET |
x_get_user_profile, x_send_dm, x_follow_user |
Username |
https://api.x.com/2/users/:id/likes |
POST |
x_like_tweet |
Tweet ID |
https://api.x.com/2/users/:id/mentions |
GET |
x_get_mentions |
User ID, pagination params |
https://api.x.com/2/users/:id/following |
POST |
x_follow_user |
Target user ID |
https://api.x.com/2/dm_conversations/with/:id/messages |
POST |
x_send_dm |
Message text, recipient ID |
https://api.x.com/2/dm_conversations/with/:id/dm_events |
GET |
x_get_dms (filtered) |
Participant ID |
https://api.x.com/2/dm_events |
GET |
x_get_dms (all) |
Pagination params |
Security & Privacy
- Network access: Only
api.x.com (official X API). No other domains are contacted.
- Local file access: Writes a session-scoped
clawbird-interactions.jsonl file to the working directory, logging mutation actions (posts, likes, follows, DMs) so the agent can avoid duplicating work. No other files are read or written beyond the declared environment variables.
- Credential handling: OAuth tokens are read from plugin config or env vars at runtime and passed to the X API via signed HTTP headers. They are never logged, cached to disk, or transmitted to any third party.
- Data sent to X: Only the data you explicitly provide in tool parameters (tweet text, search queries, usernames, message text). No additional user data is collected or sent.
- Data received from X: Tweet content, user profiles, DM messages, and engagement metrics as returned by the X API. This data is returned to the agent as JSON and not stored.
Trust Statement
Clawbird is an npm-distributed skill — the runtime code is installed via npm i -g @xonder/clawbird and is not bundled in the ClawHub skill archive. The security properties below can be verified by auditing the source:
Since this skill installs code from npm at runtime, review the source or pin a specific version (npm i -g @xonder/clawbird@1.1.0) before granting credentials.
Write Actions & Autonomous Use
The following tools modify remote state on your X account:
| Tool |
Action |
Reversible? |
| x_post_tweet |
Posts a tweet |
Delete manually |
| x_post_thread |
Posts multiple tweets |
Delete manually |
| x_reply_tweet |
Posts a reply |
Delete manually |
| x_like_tweet |
Likes a tweet |
Unlike manually |
| x_follow_user |
Follows a user |
Unfollow manually |
| x_send_dm |
Sends a direct message |
Cannot unsend |
Recommendation: If running autonomously, consider requiring explicit user confirmation before write actions by configuring agent-level tool policies. Read-only tools (x_get_tweet, x_search_tweets, x_get_user_profile, x_get_mentions, x_get_dms, x_get_cost_summary) are safe for autonomous use.
Available Tools
Posting
x_post_tweet — Post a single tweet.
text (required): Tweet content (max 280 chars)
- Returns:
{ id, text, url, estimatedCost }
x_post_thread — Post a multi-tweet thread.
tweets (required): Array of tweet texts (posted in order, each as a reply to the previous)
- Returns:
{ threadId, tweetCount, tweets: [{ id, text, url }], estimatedCost }
x_reply_tweet — Reply to an existing tweet.
tweetId (required): Tweet ID or full URL (e.g. https://x.com/user/status/123456)
text (required): Reply content (max 280 chars)
- Returns:
{ id, text, url, inReplyTo, estimatedCost }
Engagement
x_like_tweet — Like a tweet.
tweetId (required): Tweet ID or full URL
- Returns:
{ liked, tweetId, estimatedCost }
Social
x_follow_user — Follow a user.
username (required): Username to follow (with or without @)
- Returns:
{ following, user: { id, username }, estimatedCost }
Research
x_get_tweet — Get a single tweet by ID or URL.
tweetId (required): Tweet ID or full URL (e.g. https://x.com/user/status/123456)
- Returns:
{ id, text, authorId, createdAt, metrics, conversationId, lang, url, author: { id, name, username, verified, profileImageUrl }, estimatedCost }
x_search_tweets — Search recent tweets (last 7 days).
query (required): Search query — supports X operators like from:user, #hashtag, "exact phrase", -exclude, lang:en
maxResults (optional): 10–100, default 10
- Returns:
{ query, resultCount, tweets: [{ id, text, authorId, createdAt, metrics, url }], estimatedCost }
x_get_user_profile — Get a user's profile.
username (required): Username with or without @
- Returns:
{ id, name, username, description, followersCount, followingCount, tweetCount, verified, profileImageUrl, url, createdAt, location, profileUrl, estimatedCost }
x_get_mentions — Get recent mentions of the authenticated account.
maxResults (optional): 5–100, default 10
- Returns:
{ resultCount, mentions: [{ id, text, authorId, createdAt, metrics, url }], estimatedCost }
Direct Messages
x_send_dm — Send a direct message to a user.
username (required): Recipient's username (with or without @)
text (required): Message content
- Returns:
{ sent, eventId, conversationId, recipient: { id, username }, estimatedCost }
x_get_dms — Get recent direct messages.
username (optional): Filter DMs to a specific user's conversation
maxResults (optional): 1–100, default 10
- Returns:
{ resultCount, messages: [{ id, text, senderId, createdAt, conversationId, eventType }], estimatedCost }
Utility
x_get_interaction_log — Get the log of all write actions performed this session (posts, replies, likes, follows, DMs). Useful to review what has already been done and avoid duplicating actions.
limit (optional): Maximum number of recent entries to return (default: all)
- Returns:
{ totalEntries, returned, logFile, entries: [{ timestamp, action, summary, details }] }
x_get_cost_summary — Get cumulative API cost for this session.
- No parameters required
- Returns:
{ totalCost, breakdown: { [action]: { calls, totalCost } } }
Best Practices
Search Queries
- Use
from:username to search a specific user's tweets
- Use
#hashtag for hashtag search
- Use
"exact phrase" for exact matches
- Combine operators:
#AI from:openai -is:retweet lang:en
- Use
-is:retweet to filter out retweets
Thread Formatting
- Keep each tweet under 280 characters
- Start with a strong hook in tweet 1
- Number tweets (1/N) for long threads
- End with a call to action or summary
Cost Awareness
Every tool response includes an estimatedCost field. Approximate costs:
- Post/Reply: ~$0.01 per tweet
- Like: ~$0.005
- Search: ~$0.005 per result
- User lookup: ~$0.001
- Mentions: ~$0.005 per result
- Send DM: ~$0.01
- Read DMs: ~$0.005 per result
- Get tweet: ~$0.005
Use x_get_cost_summary to check cumulative session spend before expensive operations.
Rate Limits
- Posting: 200 tweets per 15 minutes
- Search: 180 requests per 15 minutes (user), 450 (app)
- Likes: 50 per 15 minutes
- User lookup: 900 per 15 minutes
- Mentions: 180 per 15 minutes
- DMs: 200 messages per 15 minutes, 1000 per 24 hours
- Following: 400 per 24 hours
Error Handling
All tools return errors as { error: "message", details?: ... }. Common issues:
- Rate limiting (wait and retry)
- Authentication errors (check API credentials)
- Tweet not found (verify ID/URL)
- Empty text (provide non-empty content)
1---
2name: clawbird
3description: "X/Twitter integration — post, reply, search, like, follow, DMs, and mentions via the official X API v2"
4homepage: https://github.com/xonder/clawbird
5metadata:
6 source: https://skillmd.com/skills/modbender/clawbird
7 openclaw:
8 emoji: "🐦"
9 requires:
10 plugins: ["clawbird"]
11 env: ["X_API_KEY", "X_API_SECRET", "X_ACCESS_TOKEN", "X_ACCESS_SECRET"]
12 primaryEnv: "X_API_KEY"
13 install:
14 - id: "npm"
15 kind: "node"
16 package: "@xonder/clawbird"
17 label: "Install clawbird plugin (npm)"
18---
19
20# Clawbird — X/Twitter Tools
21
22You have access to 13 tools for interacting with X (Twitter) via the official X API v2. All tools return JSON with results and estimated API cost.
23
24## Authentication & Credentials
25
26This plugin authenticates to the X API using **OAuth 1.0a User Context** for write operations (posting, liking, following, DMs) and optionally a **Bearer Token** for read-only operations (search, user lookup).
27
28**Where credentials come from:** You must generate them at the [X Developer Portal](https://developer.x.com):
291. Create a Project and App at developer.x.com
302. Generate OAuth 1.0a keys: API Key, API Secret, Access Token, Access Token Secret
313. Optionally generate a Bearer Token for read-only operations
32
33**How credentials are provided:** Credentials are passed to the plugin at runtime by the OpenClaw plugin config system (`pluginConfig`). The plugin never reads config files directly. Fallback: environment variables `X_API_KEY`, `X_API_SECRET`, `X_ACCESS_TOKEN`, `X_ACCESS_SECRET`, `X_BEARER_TOKEN`.
34
35**No credentials are hardcoded or bundled.** The plugin will return a clear error if credentials are missing.
36
37## External Endpoints
38
39All network requests go exclusively to the official X API v2. No other hosts are contacted.
40
41| Endpoint | Method | Tool(s) | Data Sent |
42|----------|--------|---------|-----------|
43| `https://api.x.com/2/tweets` | POST | x_post_tweet, x_post_thread, x_reply_tweet | Tweet text, reply metadata |
44| `https://api.x.com/2/tweets/:id` | GET | x_get_tweet | Tweet ID |
45| `https://api.x.com/2/tweets/search/recent` | GET | x_search_tweets | Search query string |
46| `https://api.x.com/2/users/me` | GET | x_like_tweet, x_get_mentions, x_follow_user | (auth headers only) |
47| `https://api.x.com/2/users/by/username/:username` | GET | x_get_user_profile, x_send_dm, x_follow_user | Username |
48| `https://api.x.com/2/users/:id/likes` | POST | x_like_tweet | Tweet ID |
49| `https://api.x.com/2/users/:id/mentions` | GET | x_get_mentions | User ID, pagination params |
50| `https://api.x.com/2/users/:id/following` | POST | x_follow_user | Target user ID |
51| `https://api.x.com/2/dm_conversations/with/:id/messages` | POST | x_send_dm | Message text, recipient ID |
52| `https://api.x.com/2/dm_conversations/with/:id/dm_events` | GET | x_get_dms (filtered) | Participant ID |
53| `https://api.x.com/2/dm_events` | GET | x_get_dms (all) | Pagination params |
54
55## Security & Privacy
56
57- **Network access:** Only `api.x.com` (official X API). No other domains are contacted.
58- **Local file access:** Writes a session-scoped `clawbird-interactions.jsonl` file to the working directory, logging mutation actions (posts, likes, follows, DMs) so the agent can avoid duplicating work. No other files are read or written beyond the declared environment variables.
59- **Credential handling:** OAuth tokens are read from plugin config or env vars at runtime and passed to the X API via signed HTTP headers. They are never logged, cached to disk, or transmitted to any third party.
60- **Data sent to X:** Only the data you explicitly provide in tool parameters (tweet text, search queries, usernames, message text). No additional user data is collected or sent.
61- **Data received from X:** Tweet content, user profiles, DM messages, and engagement metrics as returned by the X API. This data is returned to the agent as JSON and not stored.
62
63## Trust Statement
64
65Clawbird is an npm-distributed skill — the runtime code is installed via `npm i -g @xonder/clawbird` and is not bundled in the ClawHub skill archive. The security properties below can be verified by auditing the source:
66
67- **Source:** https://github.com/xonder/clawbird (MIT)
68- **npm:** https://www.npmjs.com/package/@xonder/clawbird
69- Makes **no network requests** other than to `api.x.com` ([source: `src/client.ts`](https://github.com/xonder/clawbird/blob/main/src/client.ts))
70- Reads and writes **one local file** (`clawbird-interactions.jsonl`) for session interaction logging — no other filesystem access ([source: `src/interaction-log.ts`](https://github.com/xonder/clawbird/blob/main/src/interaction-log.ts))
71- Has **zero transitive dependencies** beyond the official `@xdevplatform/xdk` SDK and `@sinclair/typebox`
72- Includes a comprehensive test suite (200+ tests) verifiable via `npm test`
73
74Since this skill installs code from npm at runtime, **review the source or pin a specific version** (`npm i -g @xonder/clawbird@1.1.0`) before granting credentials.
75
76## Write Actions & Autonomous Use
77
78The following tools **modify remote state** on your X account:
79
80| Tool | Action | Reversible? |
81|------|--------|-------------|
82| x_post_tweet | Posts a tweet | Delete manually |
83| x_post_thread | Posts multiple tweets | Delete manually |
84| x_reply_tweet | Posts a reply | Delete manually |
85| x_like_tweet | Likes a tweet | Unlike manually |
86| x_follow_user | Follows a user | Unfollow manually |
87| x_send_dm | Sends a direct message | Cannot unsend |
88
89**Recommendation:** If running autonomously, consider requiring explicit user confirmation before write actions by configuring agent-level tool policies. Read-only tools (x_get_tweet, x_search_tweets, x_get_user_profile, x_get_mentions, x_get_dms, x_get_cost_summary) are safe for autonomous use.
90
91## Available Tools
92
93### Posting
94
95**`x_post_tweet`** — Post a single tweet.
96- `text` (required): Tweet content (max 280 chars)
97- Returns: `{ id, text, url, estimatedCost }`
98
99**`x_post_thread`** — Post a multi-tweet thread.
100- `tweets` (required): Array of tweet texts (posted in order, each as a reply to the previous)
101- Returns: `{ threadId, tweetCount, tweets: [{ id, text, url }], estimatedCost }`
102
103**`x_reply_tweet`** — Reply to an existing tweet.
104- `tweetId` (required): Tweet ID or full URL (e.g. `https://x.com/user/status/123456`)
105- `text` (required): Reply content (max 280 chars)
106- Returns: `{ id, text, url, inReplyTo, estimatedCost }`
107
108### Engagement
109
110**`x_like_tweet`** — Like a tweet.
111- `tweetId` (required): Tweet ID or full URL
112- Returns: `{ liked, tweetId, estimatedCost }`
113
114### Social
115
116**`x_follow_user`** — Follow a user.
117- `username` (required): Username to follow (with or without `@`)
118- Returns: `{ following, user: { id, username }, estimatedCost }`
119
120### Research
121
122**`x_get_tweet`** — Get a single tweet by ID or URL.
123- `tweetId` (required): Tweet ID or full URL (e.g. `https://x.com/user/status/123456`)
124- Returns: `{ id, text, authorId, createdAt, metrics, conversationId, lang, url, author: { id, name, username, verified, profileImageUrl }, estimatedCost }`
125
126**`x_search_tweets`** — Search recent tweets (last 7 days).
127- `query` (required): Search query — supports X operators like `from:user`, `#hashtag`, `"exact phrase"`, `-exclude`, `lang:en`
128- `maxResults` (optional): 10–100, default 10
129- Returns: `{ query, resultCount, tweets: [{ id, text, authorId, createdAt, metrics, url }], estimatedCost }`
130
131**`x_get_user_profile`** — Get a user's profile.
132- `username` (required): Username with or without `@`
133- Returns: `{ id, name, username, description, followersCount, followingCount, tweetCount, verified, profileImageUrl, url, createdAt, location, profileUrl, estimatedCost }`
134
135**`x_get_mentions`** — Get recent mentions of the authenticated account.
136- `maxResults` (optional): 5–100, default 10
137- Returns: `{ resultCount, mentions: [{ id, text, authorId, createdAt, metrics, url }], estimatedCost }`
138
139### Direct Messages
140
141**`x_send_dm`** — Send a direct message to a user.
142- `username` (required): Recipient's username (with or without `@`)
143- `text` (required): Message content
144- Returns: `{ sent, eventId, conversationId, recipient: { id, username }, estimatedCost }`
145
146**`x_get_dms`** — Get recent direct messages.
147- `username` (optional): Filter DMs to a specific user's conversation
148- `maxResults` (optional): 1–100, default 10
149- Returns: `{ resultCount, messages: [{ id, text, senderId, createdAt, conversationId, eventType }], estimatedCost }`
150
151### Utility
152
153**`x_get_interaction_log`** — Get the log of all write actions performed this session (posts, replies, likes, follows, DMs). Useful to review what has already been done and avoid duplicating actions.
154- `limit` (optional): Maximum number of recent entries to return (default: all)
155- Returns: `{ totalEntries, returned, logFile, entries: [{ timestamp, action, summary, details }] }`
156
157**`x_get_cost_summary`** — Get cumulative API cost for this session.
158- No parameters required
159- Returns: `{ totalCost, breakdown: { [action]: { calls, totalCost } } }`
160
161## Best Practices
162
163### Search Queries
164- Use `from:username` to search a specific user's tweets
165- Use `#hashtag` for hashtag search
166- Use `"exact phrase"` for exact matches
167- Combine operators: `#AI from:openai -is:retweet lang:en`
168- Use `-is:retweet` to filter out retweets
169
170### Thread Formatting
171- Keep each tweet under 280 characters
172- Start with a strong hook in tweet 1
173- Number tweets (1/N) for long threads
174- End with a call to action or summary
175
176### Cost Awareness
177Every tool response includes an `estimatedCost` field. Approximate costs:
178- Post/Reply: ~$0.01 per tweet
179- Like: ~$0.005
180- Search: ~$0.005 per result
181- User lookup: ~$0.001
182- Mentions: ~$0.005 per result
183- Send DM: ~$0.01
184- Read DMs: ~$0.005 per result
185- Get tweet: ~$0.005
186
187Use `x_get_cost_summary` to check cumulative session spend before expensive operations.
188
189### Rate Limits
190- Posting: 200 tweets per 15 minutes
191- Search: 180 requests per 15 minutes (user), 450 (app)
192- Likes: 50 per 15 minutes
193- User lookup: 900 per 15 minutes
194- Mentions: 180 per 15 minutes
195- DMs: 200 messages per 15 minutes, 1000 per 24 hours
196- Following: 400 per 24 hours
197
198### Error Handling
199All tools return errors as `{ error: "message", details?: ... }`. Common issues:
200- Rate limiting (wait and retry)
201- Authentication errors (check API credentials)
202- Tweet not found (verify ID/URL)
203- Empty text (provide non-empty content)