Capabilities
Once connected, your agent can post and manage tweets on your behalf.- Post tweets on behalf of the connected account
- Delete tweets by ID
- Get authenticated user info
- Up to 280 characters per tweet (25K for Premium)
- Rate limited: 100 tweets per 15 minutes
- Secure token storage in Environment
Important: The X API requires an OAuth 2.0 User Access Token (not the App-Only Bearer Token). Follow the OAuth 2.0 setup guide below to generate the correct token.
Setup Guide
Follow these steps to connect X to your instances.1. Create an X Developer Account
Go to developer.x.com and sign up for a developer account. The free tier includes tweet posting capabilities.2. Create a Project and App
In the Developer Console, create a new Project and App. Note down yourClient ID.
3. Configure OAuth 2.0 Settings
Go to your app settings → User authentication settings → Edit:- App permissions: Read and write
- Type of App: Web App, Automated App or Bot
- Callback URL:
http://localhost:3000/callback - Website URL: Your website (e.g., https://yoursite.com)
4. Get your OAuth 2.0 User Access Token
Follow the detailed OAuth 2.0 guide below to generate a User Access Token with the required scopes.5. Store the token in Environment
Go to Environment and create a new variable:- Name:
X_ACCESS_TOKENValue: Your OAuth 2.0 User Access Token from step 4
6. Grant access to instances
Choose how instances should access the token:- Option A: Global Access (All instances) — Toggle “Make globally accessible” when creating the secret.
- Option B: Instance-Specific (Selective access) — In Environment, open the secret and grant the specific instance access.
Getting the OAuth 2.0 User Access Token
The X API requires OAuth 2.0 Authorization Code Flow with PKCE. Follow these steps exactly.A. Generate Authorization URL
ReplaceYOUR_CLIENT_ID with your actual Client ID and open this URL in your browser:
B. Authorize the App
Click “Authorize app” when prompted. X will redirect to your callback URL with acode parameter:
code value from the URL.
C. Exchange Code for Access Token
Run this curl command in your terminal. ReplaceAUTH_CODE and YOUR_CLIENT_ID:
code_verifier must match the code_challenge from step A exactly.
D. Copy the Access Token
The response will contain your access token:access_token value and store it in Environment as X_ACCESS_TOKEN.
Token Expiration
Access tokens expire after 2 hours. Save yourrefresh_token to obtain new access tokens without re-authorizing. You can use the refresh token to get a new access token:
Usage Examples
Ask your agent to post tweets using natural language. Post a tweet“Post a tweet saying: Just deployed my new AI agent! 🚀”Get account info
“Show me my X account information”Delete a tweet
“Delete tweet with ID 1234567890123456789”Tip: X rejects duplicate tweets. If you need to post similar content, add timestamps or unique identifiers.