Extract X Posts by Topic to JSON

Automate searching X.com (formerly Twitter) for a specific topic and collect a specified number of tweets from the search results, extracting key details like the tweet text, author, and engagement metrics.
This automation streamlines the process of gathering data from X.com. Here's how it works:
  • Takes Your Input: You provide a search topic (like a brand name, hashtag, or keyword) and the number of tweets you want to collect.
  • Signs In & Searches: It opens X.com, verifies you are signed in (a login is required for reliable results), and performs a search for your topic. By default, it looks at the "Top" tweets.
  • Collects Data: The automation scrolls through the search results, collecting tweets one by one. It intelligently handles popups and avoids duplicating tweets it has already seen.
  • Extracts Key Details: For each tweet, it captures the full text, the author's name and handle, and the number of replies, retweets, and likes.
  • Delivers Results: Once it reaches your target number of tweets or runs out of results, it returns all the collected information in a structured format, ready for you to use.
Usage Ideas
  • Market Research: Collect what people are saying about your brand, your competitors, or general industry trends.
  • Content Curation: Find popular or recent tweets on a specific topic to get inspiration for your own content marketing or newsletter.
  • Lead Generation: Search for users asking questions or expressing needs that your product or service can solve.
  • Social Listening: Monitor public sentiment and conversations around specific events, product launches, or marketing campaigns.
  • Academic Research: Gather large datasets of public conversations for analysis in social science or communication studies.
Customization Ideas
This template is a powerful starting point that you can easily tailor to your exact needs. You can ask the Agent Builder Assistant to:
  • Change the Search Criteria: Instead of "Top" tweets, you can switch to "Latest" to get a real-time feed of conversations.
  • Customize the Data: You can modify what information is collected for each tweet. For example, you could ask to include the tweet's specific URL, the time it was posted, or its view count.
  • Integrate with Other Tools: The collected data can be automatically sent to other applications. You could have the results saved to a Google Sheet for analysis, added to an Airtable database, or used to trigger a Slack notification.
  • Adjust Collection Volume: You can easily change the target number of tweets to collect for any given search, from a handful to hundreds.
Agent Inputs
Required Parameters
Name
Type
Default
searchTopic
string
None
The topic to search for on X.com (e.g., 'AI Agents', 'climate change')
Optional Parameters
Name
Type
Default
numberOfTweets
number
10
How many tweets to collect from the search results