Skip to content

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:

TierCostTweet Posts/MonthRead Tweets/Month
Free$01,5000
Basic$100/mo3,00010,000
Pro$5,000/mo300,0001,000,000
EnterpriseCustomCustomCustom

IMPORTANT

For production use with multiple users, Basic tier is the minimum recommended.

Required Scopes (OAuth 2.0) ​

ScopePurpose
tweet.readRead tweets
tweet.writePost tweets
users.readRead user info
media.writeUpload images, GIFs, and videos for posts
offline.accessRefresh tokens (required for long-lived access)

Optional Scopes ​

ScopePurpose
dm.readRead DMs
dm.writeSend DMs
follows.readRead following/followers
like.readRead likes
like.writeLike tweets

Callback URL ​

text
https://api.tendsocial.com/api/company/social-accounts/callback/TWITTER

Set in: Developer Portal → Your App → User authentication settings → Callback URI

The callback URI must match the URI passed into the OAuth authorize request exactly. In production, set OAUTH_REDIRECT_BASE_URL=https://api.tendsocial.com so callback exchange uses the same URI registered in X.

Environment Variables ​

bash
TWITTER_CLIENT_ID=your_client_id
TWITTER_CLIENT_SECRET=your_client_secret

OAuth 2.0 with PKCE ​

X requires PKCE (Proof Key for Code Exchange) for OAuth 2.0:

  1. Generate code_verifier (random 43-128 character string)
  2. Create code_challenge = BASE64URL(SHA256(code_verifier))
  3. Include code_challenge and code_challenge_method=S256 in auth URL
  4. Include code_verifier when exchanging code for tokens

TendSocial handles this automatically via the Twitter adapter.

IMPORTANT

The token exchange must use the same code_verifier generated during authorization. Verify the PKCE state/verifier flow before submitting for X review or the reviewer will not be able to connect an account.

Platform Limitations ​

FeatureStatus
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

For the initial review, request posting and media upload scopes only: tweet.read, tweet.write, users.read, media.write, and offline.access. Request DM scopes later only when the inbox workflow is ready to demonstrate end to end.

TendSocial Documentation