Skip to main content

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.

FieldRequiredDescription
bearer_tokenYes (or access_token)App-only Bearer token from the Twitter Developer Portal → Keys and Tokens. Used for read-only bearerGet calls.
access_tokenYes (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_keyYes (for writes)OAuth 1.0a consumer key.
api_secretYes (for writes)OAuth 1.0a consumer secret.
access_token_secretYes (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

ParameterTypeRequiredDescription
textstringYesTweet text (max 280 chars). Supports URLs and @mentions
reply_to_idstringNoTweet 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

ParameterTypeRequiredDescription
tweet_idstringYesID of the tweet to reply to
textstringYesReply 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

ParameterTypeRequiredDescription
querystringYesSearch query. Supports operators: from:user, to:user, #hashtag, @mention, lang:en, -is:retweet
max_resultsnumberNoNumber of results (10-100, default 20)
sort_orderstringNoSort 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

ParameterTypeRequiredDescription
tweet_idstringYesTweet 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

ParameterTypeRequiredDescription
usernamestringYesTwitter 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

ParameterTypeRequiredDescription
user_idstringYesTwitter user ID to get mentions for (not username)
max_resultsnumberNoNumber 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

ParameterTypeRequiredDescription
user_idstringYesTwitter user ID to get timeline for
max_resultsnumberNoNumber 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

ParameterTypeRequiredDescription
user_idstringYesTwitter user ID performing the like action
tweet_idstringYesTweet 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

ParameterTypeRequiredDescription
user_idstringYesTwitter user ID performing the retweet
tweet_idstringYesTweet 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

ParameterTypeRequiredDescription
tweet_idstringYesID 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.".

Next