Skip to main content

Divverse

Twitter/X Intelligence Agents (Scott and Jack) for Market Research 

Millicent Atasie

Millicent Atasie

Twitter/X Intelligence Agents (Scott and Jack)

Twitter/X can reveal what people are saying about a topic, product, market, industry, or customer problem in real time. However, useful insight is often buried across hundreds of scattered posts, reactions, opinions, and repeated conversations.

This use case explores how a connected AI automation can monitor Twitter/X around a keyword, collect relevant posts, remove duplicates, analyse the conversation, and turn the results into a business-ready intelligence report delivered by email.

The Problem

Tracking what people are actually saying about a topic, product, or industry on Twitter/X can be difficult to manage consistently.

One part of the work is discovery: finding relevant posts, monitoring new conversations, and keeping a clean record of what has already been collected. The second part is analysis: turning scattered tweets into useful business insight, including themes, sentiment, pain points, market signals, opportunities, and next actions.

Most teams either do not monitor consistently, or someone manually reviews a feed and turns a few observations into a loose summary. This makes it hard to build a reliable intelligence process from social conversations.

The Solution

Scott and Jack work as a two-agent Twitter/X intelligence pipeline.

Scott is the discovery agent. It turns a plain-language keyword into an optimised Twitter/X search, scrapes relevant tweets, deduplicates them, and logs new results daily.

Jack is the intelligence agent. It reads the tweets collected for that keyword and turns them into a structured business-intelligence report covering discussion topics, sentiment, engagement, pain points, opportunities, recommended actions, and top influencers.

The two agents are connected, so once Scott collects new tweets, Jack can automatically begin the analysis process.

How the Agent Works

  1. Capture the monitoring keyword. The workflow starts with a keyword or topic entered into a connected spreadsheet.
  2. Optimise the Twitter/X search. AI reviews the keyword, determines whether it is already specific or needs discovery support, and prepares an improved search query.
  3. Collect and clean tweets. The workflow scrapes relevant Twitter/X posts, structures the tweet data, and removes duplicates using existing tweet IDs.
  4. Analyse the conversation. A second AI agent reviews the collected tweets and identifies major topics, sentiment, pain points, opportunities, influencers, and recommended actions.
  5. Generate and deliver the report. The workflow creates a business-ready HTML report and sends it by email, while also logging a summary for tracking.

Technical Workflow

1. Keyword-driven daily trigger, Scott

A keyword is read from an “Input” Google Sheets tab on a daily schedule. A single search query is all it takes to start a monitoring cycle.

2. AI search-query optimization

An LLM (GPT-5.2), the “Twitter Search Optimizer,” classifies the request into “direct” mode, already a clean topic or product term, or “discovery” mode, vague or trend-seeking language like “what’s trending.”

In discovery mode, it performs its own web search across recent tech, news, and developer sources to surface concrete, currently relevant terms rather than guessing.

It also maps user intent to a Twitter search mode, Latest / Top / Popular, and returns keywords plus a confidence score.

3. Parse and sanitize the AI plan

A code node safely parses the JSON, with a hardcoded fallback if parsing fails, validates mode and search type against allowed values, caps the keyword count, tightens direct-mode searches to the top 3 keywords, and builds one comma-joined query string for the scraper.

4. Scrape via Apify

The optimized keyword string, search type, and a minimum-likes filter are passed to a Twitter/X search-scraper Apify actor, pulling up to 15 pages of English-language results.

5. Transform raw tweets

A code node reshapes each raw tweet into a clean record: scrape date, tweet ID, author handle and name, text truncated to 500 characters, likes, retweets, replies, views, a reconstructed tweet URL, and the originating keyword.

6. Deduplicate against history

Existing tweet IDs are read from the “Results” sheet and used to filter out anything already collected, so re-running the same keyword never creates duplicate rows.

7. Log and summarize

Genuinely new tweets are appended to the Results sheet. A summary node identifies the single highest-liked tweet in the new batch as a quick highlight.

8. Hand off to the Intelligence Agent

Once new tweets are logged, an HTTP request POSTs the keyword to Jack’s webhook, kicking off analysis immediately rather than waiting for Jack’s own schedule.

9. Triggered by webhook or schedule, Jack

Jack starts either from Scott’s webhook call or its own daily schedule an hour later, reads the same keyword, and pulls every stored tweet for it from the Results sheet.

10. Prepare full-dataset analysis input

A code node filters to just this keyword’s tweets, computes average likes, retweets, and replies across the entire set, identifies the top 3 most-engaged tweets, determines the date range covered, and formats every tweet’s text into one block for the AI, with no sampling or truncation of the dataset.

11. AI business-intelligence analysis

A second LLM (GPT-5.2) call, prompted as a “world-class business intelligence analyst,” returns a large structured JSON object: five ranked discussion topics, each with percentage share, sentiment, subtopics, and a named business opportunity; an overall sentiment breakdown; engagement insights; key pain points; three prioritized business opportunities, including demand signal, market size, and competition; three recommended actions; top influencers; and a short executive summary.

The workflow includes hard rules that topic percentages must sum to 100 and the whole response must be pure, parseable JSON.

12. Parse, validate, and log

A code node safely parses the response, with a graceful fallback structure on failure, backfills any missing arrays, and writes a condensed summary row, date, keyword, tweet count, sentiment split, top opportunity, and top recommendation, to a separate “Insights Summary” sheet.

13. Generate and send the report

A code node builds a full, self-contained HTML email with a gradient header, sentiment cards, progress-bar topic breakdowns, color-coded opportunity and recommendation blocks, and a most-engaged-tweets section.

The report is then sent via Gmail.

14. Close the loop

After sending, the same Insights Summary row is updated to mark the report as sent, and a final log node confirms the run completed for that keyword.

A parallel “No Tweets Found” path logs gracefully instead of erroring if nothing has been collected yet.

Technology and Integrations

Built with: n8n, Apify Twitter/X Search Scraper, OpenAI GPT-5.2, Google Sheets, Gmail, webhooks, and connected reporting workflows.

Outcome

Scott and Jack create a structured way to turn Twitter/X monitoring into business intelligence.

A single keyword entered into a spreadsheet can become a continuously growing, deduplicated tweet archive. The intelligence layer then turns that archive into a business-framed report covering discussion topics, sentiment, pain points, named opportunities, top influencers, and concrete next actions.

Because the discovery and analysis agents are connected, teams do not have to manually run each step or remember to prepare reports from raw social data.

Build Custom AI Automation for Your Business

Twitter/X Intelligence Agents (Scott and Jack) are examples of how AI automation can support market research, social listening, trend analysis, competitor monitoring, and business-intelligence workflows.

Divverse Labs designs and builds custom AI agents, automation workflows, internal tools, and connected systems for a wide range of business processes.

From sales, marketing, recruitment, customer support, and reporting to finance, operations, data, and internal team workflows, each solution is designed around the way your business works.

Request a Quote for a Custom AI Automation Solution to get started.