This workflow automates Twitter/X API v2 tasks, replacing manual tweet posting, user data retrieval, and search operations via the Twitter Developer Portal, which is time-consuming and error-prone due to short-lived access tokens (2 hours). It handles OAuth 2.0 authentication, token refresh, posting tweets, fetching user tweets, retrieving user information, and searching for recent tweets. Key nodes include Manual Trigger for testing, Set for input validation (client_id, client_secret, refresh_token, user_id), IF for credential and token checks, HTTP Request for token refresh and API operations (post_tweet, get_tweets, get_user_info, search_tweets), and Set for success/error responses. Ideal for social media managers handling 10+ tweets daily, it streamlines content scheduling, engagement tracking, and real-time monitoring, reducing manual effort and ensuring API uptime.\n\nSaves 3-7 hours weekly automating 10+ tweets or searches, cutting downtime by 90%. Suits small to medium marketing teams or content creators. Requires Twitter Developer App (free for Basic tier, 100 tweets/month) and n8n cloud ($20/month) or self-hosted (free). Scalable to 300 tweets/15min (Basic tier limit), constrained by Twitter’s rate limits (450 searches/15min, 75 user lookups/15min). No webhook needed unless replacing trigger.\n\nInstall n8n from n8n.io or cloud.n8n.io ($20/month unlimited). Create a Twitter App at developer.twitter.com, get client_id, client_secret, and refresh_token via OAuth2 flow (see https://developer.twitter.com/en/docs/authentication/oauth-2-0). Set TWITTER_CLIENT_ID, TWITTER_CLIENT_SECRET, TWITTER_REFRESH_TOKEN, TWITTER_ACCESS_TOKEN, TWITTER_TOKEN_EXPIRES_AT, TWITTER_USER_ID in n8n environment variables. Configure HTTP Request for token refresh and API calls. For Webhook, add Webhook node, set path to ‘twitter’, and use URL (e.g., https://your-n8n/webhook/twitter123).\n\nTest manually: Run with operation=’post_tweet’, tweet_text=’Test tweet’, verify tweet on Twitter/X, or use search_tweets with search_query=’from:user’. Common errors: invalid refresh_token (re-authenticate via OAuth), rate limits (add Wait node, 2s delay), or scope issues (ensure tweet.read, tweet.write, users.read). Deploy by activating; monitor logs. Maintain by storing tokens in a database, scheduling token checks every 90 minutes, and adjusting max_results for large-scale searches.", "businessValue": "Saves 3-7 hours/week automating Twitter/X content and engagement tracking", "setupTime": "20-30 minutes", "difficulty": "Intermediate", "requirements": ["Twitter Developer App (free Basic tier, with client_id and client_secret)", "Valid refresh token and user ID", "n8n cloud ($20/month) or self-hosted (free)"], "useCase": "Automating Twitter/X tweet posting, user data retrieval, and search operations"
$5.49
Workflow steps: 20
Integrated apps: manualTrigger, set, if