Twitter / X
Connects to the Twitter/X API v2. An agent can post tweets and replies, search recent tweets, look up tweets and users, read mentions and timelines, like/retweet, and delete tweets.
This connector's tools are also used by the twitter-send workflow node.
Add to an agent node's tools array with _node_type: "tool-twitter" (alias tool-x). See Connector Reference — How connectors are used.
Authentication
Read-only tools (search, get tweet, get user, get mentions, get timeline) require only a bearer token. Write tools (post, reply, like, retweet, delete) require full OAuth 1.0a credentials with "Read and Write" app permissions.
| Field | Required | Description |
|---|---|---|
bearer_token | Yes (or access_token) | App-only Bearer token from the Twitter Developer Portal → Keys and Tokens. Used for read-only bearerGet calls. |
access_token | Yes (if bearer_token not set) | Used as the bearer token if bearer_token is empty; also used as the OAuth 1.0a access token for write operations. |
api_key | Yes (for writes) | OAuth 1.0a consumer key. |
api_secret | Yes (for writes) | OAuth 1.0a consumer secret. |
access_token_secret | Yes (for writes) | OAuth 1.0a access token secret. |
{
"name": "twitter",
"_node_type": "tool-twitter",
"bearer_token": "{{ secret.TWITTER_BEARER_TOKEN }}",
"api_key": "{{ secret.TWITTER_API_KEY }}",
"api_secret": "{{ secret.TWITTER_API_SECRET }}",
"access_token": "{{ secret.TWITTER_ACCESS_TOKEN }}",
"access_token_secret": "{{ secret.TWITTER_ACCESS_TOKEN_SECRET }}"
}
Quick setup: create a Project and App at developer.twitter.com, copy the Consumer Keys and generate an Access Token/Secret under "Keys and Tokens", and set App permissions to "Read and Write" to enable posting.
Tools
twitter_post_tweet
Post a new tweet (X post) to the authenticated account. Supports threading by replying to an existing tweet ID. Requires OAuth 1.0a credentials.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
text | string | Yes | Tweet text (max 280 chars). Supports URLs and @mentions |
reply_to_id | string | No | Tweet ID to reply to (creates a thread, optional) |
Returns: A confirmation message with the new tweet's ID and a link to view it.
twitter_reply_tweet
Reply to an existing tweet. The reply will be threaded under the original tweet. Requires OAuth 1.0a credentials.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
tweet_id | string | Yes | ID of the tweet to reply to |
text | string | Yes | Reply text (max 280 chars) |
Returns: A confirmation message with the new reply's ID and the tweet it replied to.
twitter_search_tweets
Search recent tweets (last 7 days for free tier) by keyword, hashtag, user, or advanced query operators.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | Yes | Search query. Supports operators: from:user, to:user, #hashtag, @mention, lang:en, -is:retweet |
max_results | number | No | Number of results (10-100, default 20) |
sort_order | string | No | Sort by: recency (default) or relevancy |
Returns: A summary line with the total result count followed by - [date] @author (id: <id>) ❤️<likes> 🔁<retweets>\n <text> lines, or "No tweets found for query: ...".
twitter_get_tweet
Get a single tweet by ID with full metrics: likes, retweets, replies, impressions, and author info.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
tweet_id | string | Yes | Tweet ID to retrieve |
Returns: The tweet text, author ID, date, and metrics (likes, retweets, replies, quotes, impressions), or an error if not found.
twitter_get_user
Get a Twitter/X user's profile: bio, follower count, following count, tweet count, and verification status.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
username | string | Yes | Twitter username without @ (e.g. elonmusk) |
Returns: The user's name, verification badge, join date, bio, location, and follower/following/tweet counts, or an error if not found.
twitter_get_mentions
Get recent tweets that mention a specific Twitter user ID. Returns tweet text, author, timestamp, and metrics.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
user_id | string | Yes | Twitter user ID to get mentions for (not username) |
max_results | number | No | Number of mentions to return (5-100, default 20) |
Returns: A newline-separated list of [date] @author (id: <id>): <text> lines, or "No recent mentions found.".
twitter_get_timeline
Get recent tweets from a user's timeline (their own posts). Returns text, timestamp, and engagement metrics.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
user_id | string | Yes | Twitter user ID to get timeline for |
max_results | number | No | Number of tweets to return (5-100, default 20) |
Returns: A newline-separated list of [date] (id: <id>) ❤️<likes> 🔁<retweets>: <text> lines (excluding retweets and replies), or "No tweets found.".
twitter_like_tweet
Like a tweet on behalf of the authenticated user. Requires OAuth 1.0a credentials.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
user_id | string | Yes | Twitter user ID performing the like action |
tweet_id | string | Yes | Tweet ID to like |
Returns: A confirmation message, or "Already liked or like failed.".
twitter_retweet
Retweet a tweet on behalf of the authenticated user. Requires OAuth 1.0a credentials.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
user_id | string | Yes | Twitter user ID performing the retweet |
tweet_id | string | Yes | Tweet ID to retweet |
Returns: A confirmation message, or "Already retweeted or retweet failed.".
twitter_delete_tweet
Permanently delete a tweet from the authenticated account. Requires OAuth 1.0a credentials.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
tweet_id | string | Yes | ID of the tweet to delete (must be owned by the authenticated account) |
Returns: A confirmation message that the tweet was deleted, or "Delete may have failed.".