Quick Start
Get started with X Tool in three simple steps.1
Simple Post
2
Function Helper
3
Agent Usage
Installation
Install the required packages to get started with X Tool.How It Works
X Tool supports three authentication modes for different use cases.OAuth 1.0a Setup (Recommended for Posting)
1
Create X Developer Account
Visit developer.x.com and create a developer account.
2
Create App and Get Keys
- Create a new app in the X Developer Portal
- Generate API Key and API Key Secret
- Enable OAuth 1.0a with read/write permissions
- Generate Access Token and Access Token Secret
3
Configure Environment Variables
4
Test Authentication
Configuration Options
Configure X Tool with your API credentials and preferences.XTool Class
XTool.post() Parameters
The text content of the post (up to 280 characters for basic accounts)
ID of post to reply to
ID of post to quote (Enterprise plan required)
List of uploaded media IDs to attach
List of local file paths to upload and attach
Poll choices (2-4 options, each up to 25 chars)
Poll duration in minutes (5-10080, default 24 hours)
Function Helpers
Common Patterns
- Simple Post
- Post with Media
- Thread Creation
- Poll Creation
Agent Integration Patterns
- Customer Support Bot
- Content Curator
Authentication Flow Diagram
Best Practices
Use OAuth 1.0a for Posting
Use OAuth 1.0a for Posting
OAuth 1.0a provides full posting capabilities, while app-only bearer tokens are read-only.
Handle Rate Limits Gracefully
Handle Rate Limits Gracefully
Implement exponential backoff to handle rate limits (300 posts per 15 minutes).
Manage Character Limits
Manage Character Limits
Split long content into threaded posts for better readability.
Secure Credential Management
Secure Credential Management
Store credentials in environment variables rather than hardcoding them.
Premium Features
Some features require X Premium or Enterprise plans:
- Extended character limits (Premium: up to 25,000 characters)
- Advanced search operators (Premium)
Related
Tools Overview
Explore all available PraisonAI tools
Slack Integration
Send messages to Slack channels
Telegram Bot
Send messages via Telegram bots
Custom Tools
Create your own custom tools

