X (Twitter) Setup
Configure X (Twitter) integration through the Twitter Developer Portal.
Prerequisites
- Twitter Developer Account
- Project with appropriate access tier
- OAuth 2.0 with PKCE enabled
Access Tiers
X offers different API access tiers with varying capabilities:
| Tier | Cost | Tweet Posts/Month | Read Tweets/Month |
|---|---|---|---|
| Free | $0 | 1,500 | 0 |
| Basic | $100/mo | 3,000 | 10,000 |
| Pro | $5,000/mo | 300,000 | 1,000,000 |
| Enterprise | Custom | Custom | Custom |
IMPORTANT
For production use with multiple users, Basic tier is the minimum recommended.
Required Scopes (OAuth 2.0)
| Scope | Purpose |
|---|---|
tweet.read | Read tweets |
tweet.write | Post tweets |
users.read | Read user info |
offline.access | Refresh tokens (required for long-lived access) |
Optional Scopes
| Scope | Purpose |
|---|---|
dm.read | Read DMs |
dm.write | Send DMs |
follows.read | Read following/followers |
like.read | Read likes |
like.write | Like tweets |
Callback URL
https://api.tendsocial.com/api/social/accounts/callback/twitterSet in: Developer Portal → Your App → User authentication settings → Callback URI
Environment Variables
bash
TWITTER_CLIENT_ID=your_client_id
TWITTER_CLIENT_SECRET=your_client_secretOAuth 2.0 with PKCE
X requires PKCE (Proof Key for Code Exchange) for OAuth 2.0:
- Generate
code_verifier(random 43-128 character string) - Create
code_challenge= BASE64URL(SHA256(code_verifier)) - Include
code_challengeandcode_challenge_method=S256in auth URL - Include
code_verifierwhen exchanging code for tokens
TendSocial handles this automatically via the Twitter adapter.
Platform Limitations
| Feature | Status |
|---|---|
| Text tweets | ✅ Supported (280 chars, or 25,000 for Premium) |
| Images | ✅ Up to 4 images per tweet |
| Videos | ✅ Supported |
| Polls | ❌ Not available via API |
| Threads | ✅ Supported (reply to own tweet) |
| Scheduled tweets | ❌ Not available via API (use TendSocial scheduler) |
| DMs | ⚠️ Requires elevated access |
| Analytics | ⚠️ Limited in lower tiers |
App Permissions Configuration
In Developer Portal → Your App → User authentication settings:
- App permissions: Read and write
- Type of App: Web App
- Callback URI: Your callback URL
- Website URL: Your app's website