Twitter Automation API (POST, REPLY, LIKE,  RETWEET, SCRAP)) avatar

Twitter Automation API (POST, REPLY, LIKE, RETWEET, SCRAP))

Under maintenance

Pricing

$15.00 / 1,000 results

Go to Apify Store
Twitter Automation API (POST, REPLY, LIKE,  RETWEET, SCRAP))

Twitter Automation API (POST, REPLY, LIKE, RETWEET, SCRAP))

Under maintenance

A powerful and flexible Twitter/X automation API built as an Apify Actor. This API enables you to scrape tweets, post new tweets, reply to tweets, like tweets, and retweet using Playwright browser automation.

Pricing

$15.00 / 1,000 results

Rating

5.0

(2)

Developer

Mahmoud Alhamdo

Mahmoud Alhamdo

Maintained by Community

Actor stats

5

Bookmarked

17

Total users

4

Monthly active users

28 days

Issues response

12 days ago

Last modified

Share

Twitter Automation API

A powerful and flexible Twitter/X automation API built as an Apify Actor. This API enables you to scrape tweets, post new tweets, reply to tweets, like tweets, and retweet using browser automation.

πŸš€ Features

  • Multiple Modes:

    • User Mode: Scrape latest tweets from any Twitter/X user profile
    • Single Tweet Mode: Extract data from a specific tweet URL
    • Post Mode: Publish a new tweet
    • Reply Mode: Reply to a specific tweet
    • Like Mode: Like a single tweet or multiple tweets (up to 5)
    • Retweet Mode: Retweet a single tweet or multiple tweets (up to 5)
  • Comprehensive Data Extraction:

    • Tweet text content
    • Tweet ID and URL
    • Author username
    • Timestamp
    • Engagement metrics (likes, retweets, replies, views, bookmarks)
    • Image URLs (if present)
    • Image detection flag
  • Smart Features:

    • Automatic pinned tweet filtering
    • Real-time data saving to dataset
    • Duplicate tweet detection
    • Automatic scrolling for pagination
    • Batch operations: Like or retweet up to 5 tweets at once
    • Configurable delays between actions to avoid rate limiting
    • Organized output views for different operation types
  • Robust & Reliable:

    • Error handling and retry logic
    • Realistic browser behavior
    • Smart waiting mechanisms

πŸ“‹ Input Parameters

Required

  • mode (string): Operation mode - "user", "single", "post", "reply", "like", or "retweet"

Authentication (Required for interaction modes)

  • ct0 (string): Twitter ct0 cookie for authentication (required for post, reply, like, retweet modes)
  • auth_token (string): Twitter auth_token cookie for authentication (required for post, reply, like, retweet modes)

For User Mode (Scraping)

  • username (string): Twitter username without @ (e.g., "AlamawiEth")
  • maxTweets (integer): Maximum number of tweets to scrape (1-1000, default: 3)
  • maxDaysOld (integer): Only scrape tweets from the last N days (0 = no limit, default: 2)

For Single Tweet Mode

  • tweetUrl (string): Full URL of the tweet to scrape

For Post Mode (Publish Tweet)

  • tweetText (string, required): Text content of the tweet to post

For Reply Mode

  • replyTweetUrl (string, required): URL of the tweet to reply to
  • replyText (string, required): Text content of the reply

For Like Mode

  • tweetUrl (string, optional): URL of a single tweet to like (use this OR tweetUrls)
  • tweetUrls (array, optional): Array of tweet URLs to like (maximum 5 tweets). Use this for multiple likes.
  • delayBetweenActions (integer, optional): Delay in seconds between processing each tweet when using multiple tweets (0-60, default: 2). Helps avoid rate limiting.

Note: Use either tweetUrl for a single tweet OR tweetUrls for multiple tweets (up to 5).

For Retweet Mode

  • tweetUrl (string, optional): URL of a single tweet to retweet (use this OR tweetUrls)
  • tweetUrls (array, optional): Array of tweet URLs to retweet (maximum 5 tweets). Use this for multiple retweets.
  • delayBetweenActions (integer, optional): Delay in seconds between processing each tweet when using multiple tweets (0-60, default: 2). Helps avoid rate limiting.

Note: Use either tweetUrl for a single tweet OR tweetUrls for multiple tweets (up to 5).

πŸ“ Example Inputs

User Mode

{
"mode": "user",
"username": "apify",
"maxTweets": 50,
"maxDaysOld": 5
}

Post Tweet Mode

{
"mode": "post",
"tweetText": "Hello from Apify Actor! πŸš€",
"ct0": "your_ct0_cookie_value",
"auth_token": "your_auth_token_value"
}

Reply Mode

{
"mode": "reply",
"replyTweetUrl": "https://x.com/user1/status/1234567890",
"replyText": "Great tweet! Thanks for sharing.",
"ct0": "your_ct0_cookie_value",
"auth_token": "your_auth_token_value"
}

Like Mode - Single Tweet

{
"mode": "like",
"tweetUrl": "https://x.com/user1/status/1234567890",
"ct0": "your_ct0_cookie_value",
"auth_token": "your_auth_token_value"
}

Like Mode - Multiple Tweets

{
"mode": "like",
"tweetUrls": [
"https://x.com/user1/status/1234567890",
"https://x.com/user2/status/0987654321",
"https://x.com/user3/status/1122334455"
],
"delayBetweenActions": 3,
"ct0": "your_ct0_cookie_value",
"auth_token": "your_auth_token_value"
}

Retweet Mode - Multiple Tweets

{
"mode": "retweet",
"tweetUrls": [
"https://x.com/user1/status/1234567890",
"https://x.com/user2/status/0987654321"
],
"delayBetweenActions": 3,
"ct0": "your_ct0_cookie_value",
"auth_token": "your_auth_token_value"
}

πŸ“Š Output Schema

The Actor provides organized output views in Apify Console for different operation types:

  • πŸ“Š Overview: Complete view of all operations
  • ✍️ Posted Tweets: View for posted tweets
  • πŸ’¬ Replies: View for replies
  • ❀️ Likes: View for liked tweets
  • πŸ”„ Retweets: View for retweeted tweets
  • πŸ” Scraped Tweets: View for scraped tweets

For Scraping Modes (user, single)

Each tweet in the dataset contains:

{
"tweetId": "1987766870477619331",
"text": "Tweet text content...",
"username": "AlamawiEth",
"timestamp": "2025-11-10T06:18:47.000Z",
"url": "https://x.com/user1/status/1234567890",
"likes": 59,
"retweets": 4,
"replies": 7,
"views": 24796,
"bookmarks": 0,
"images": [
"https://pbs.twimg.com/media/XXX?format=jpg&name=medium"
],
"hasImages": true,
"scrapedAt": "2025-11-12T05:00:15.702372"
}

For Post Mode

{
"success": true,
"mode": "post",
"tweetId": "1987766870477619331",
"url": "https://x.com/user1/status/1234567890",
"text": "Tweet text...",
"postedAt": "2025-11-12T05:00:15.702372"
}

For Reply Mode

{
"success": true,
"mode": "reply",
"originalTweetUrl": "https://x.com/user1/status/1234567890",
"replyId": "1987766870477619331",
"replyUrl": "https://x.com/user1/status/1987766870477619331",
"replyText": "Reply text...",
"repliedAt": "2025-11-12T05:00:15.702372"
}

For Like/Retweet Mode

Single Tweet:

{
"success": true,
"mode": "like",
"tweetUrl": "https://x.com/user1/status/1234567890",
"action": "liked",
"likedAt": "2025-11-12T05:00:15.702372"
}

Multiple Tweets:

{
"success": true,
"mode": "like",
"tweetUrl": "https://x.com/user1/status/1234567890",
"tweetIndex": 1,
"totalTweets": 3,
"action": "liked",
"likedAt": "2025-11-12T05:00:15.702372"
}

πŸ” Authentication Setup

Authentication cookies are required for all interaction modes (post, reply, like, retweet) and recommended for scraping modes.

How to Get Cookies

  1. Install Cookie Editor Extension:

  2. Login to Twitter/X:

  3. Extract Cookies:

    • Open Cookie Editor extension
    • Search for ct0 and copy its value
    • Search for auth_token and copy its value
  4. Use in Actor Input:

    • Paste the values in the ct0 and auth_token fields

⚠️ Security Warning

  • Never share your cookies with anyone you don't trust
  • Cookies contain sensitive login information
  • Anyone with your cookies can access your account
  • Only use cookies in secure environments
  • Consider using a separate Twitter account for automation

Benefits of Using Cookies

  • βœ… Access to advanced search with date filters
  • βœ… Better filtering of recent tweets
  • βœ… More reliable scraping results
  • βœ… Required for all interaction modes

πŸ“– How It Works

User Mode

  1. Navigate to user profile or use advanced search (if authenticated)
  2. Extract tweets one by one
  3. Filter by date if maxDaysOld is set
  4. Skip pinned tweets automatically
  5. Save to dataset in real-time
  6. Continue until reaching maxTweets or no more tweets available

Post Mode

  1. Navigate to Twitter home page
  2. Enter tweet text
  3. Submit tweet
  4. Return posted tweet data (URL, ID, timestamp)

Reply Mode

  1. Navigate to the tweet URL
  2. Click reply button
  3. Enter reply text
  4. Submit reply
  5. Return reply confirmation with URL and ID

Like/Retweet Mode

Single Tweet:

  1. Navigate to the tweet URL
  2. Click like/retweet button
  3. Confirm action (for retweet)
  4. Return confirmation

Multiple Tweets:

  1. Process each tweet sequentially
  2. Wait for configured delay between actions
  3. Return results with index and total count
  4. Continue until all tweets are processed

🎯 Use Cases

  • Social Media Monitoring: Track tweets from specific accounts
  • Content Analysis: Analyze tweet engagement metrics
  • Image Collection: Extract images from tweets
  • Data Research: Collect tweet data for analysis
  • Brand Monitoring: Monitor mentions and engagement
  • Automated Posting: Schedule and post tweets automatically
  • Engagement Automation: Automatically like, retweet, or reply to tweets
  • Social Media Management: Manage Twitter account interactions programmatically
  • Batch Operations: Process multiple tweets efficiently with configurable delays

πŸ”’ Privacy & Compliance

  • This Actor respects Twitter/X's public data
  • Authentication (cookies) is required for interaction modes (post, reply, like, retweet)
  • Authentication (cookies) is optional but recommended for scraping modes (user, single)
  • Private profiles will not be accessible
  • Never share your cookies - they contain sensitive login information
  • Important: All interaction modes require valid authentication cookies
  • Please review Twitter/X Terms of Service before use
  • Be mindful of rate limits when using interaction modes

Note: This Actor is designed for educational and research purposes. Always comply with Twitter/X Terms of Service and applicable laws when scraping data.