Browser

analyzing-twitter-sentiment-for-topic

Try it

Analyzes public sentiment on Twitter/X for any topic, brand, or event using apidojo's Tweet scrapers on Apify. Triggers when the user asks to: analyze Twitter sentiment about a topic, measure public opinion on Twitter, see if sentiment is positive or negative about a brand or issue on X, analyze the emotional tone of tweets about an event, research how Twitter reacts to a news story, measure brand or product sentiment from tweets, or compare sentiment between two competing topics or brands on Twitter. Returns sentiment classification, top positive and negative tweets, volume over time, and key themes. Ideal for PR teams, market researchers, political analysts, and social listening platforms.

What it does

Analyzes public sentiment on Twitter/X for any topic, brand, or event using apidojo's Tweet scrapers on Apify. Triggers when the user asks to: analyze Twitter sentiment about a topic, measure public opinion on Twitter, see if sentiment is positive or negative about a brand or issue on X, analyze the emotional tone of tweets about an event, research how Twitter reacts to a news story, measure brand or product sentiment from tweets, or compare sentiment between two competing topics or brands on Twitter. Returns sentiment classification, top positive and negative tweets, volume over time, and key themes. Ideal for PR teams, market researchers, political analysts, and social listening platforms.

The skill document

Analyzing Twitter Sentiment for a Topic

Collects a sample of tweets about any topic or keyword and performs sentiment analysis across the dataset. Identifies dominant emotional tone, key themes driving positive/negative sentiment, and volume patterns over time.

Prerequisites

  • APIFY_TOKEN environment variable set
  • Optional: Apify MCP server installed

Inputs

ParameterTypeRequiredDefaultNotes
searchTermsarray[]Twitter advanced search queries (e.g. ["#AI lang:en", "from:NASA"])
sortstringOptionalTopSort order: Latest, Top, or Latest+Top
tweetLanguagestringOptionalISO 639-1 language code (e.g. en)
maxItemsnumberOptionalUnlimitedMaximum tweets to return
onlyVerifiedUsersbooleanOptionalfalseOnly tweets from verified users
onlyTwitterBluebooleanOptionalfalseOnly Twitter Blue subscribers
onlyImagebooleanOptionalfalseOnly tweets with images
onlyVideobooleanOptionalfalseOnly tweets with videos
onlyQuotebooleanOptionalfalseOnly quote tweets
authorstringOptionalFilter to a specific author handle
inReplyTostringOptionalTweets replying to a specific handle
mentioningstringOptionalTweets mentioning a specific handle
geotaggedNearstringOptionalTweets near a location
withinRadiusstringOptionalRadius around geotaggedNear
geocodestringOptionalLat/lng + radius string
placeObjectIdstringOptionalTweets tagged with a place
minimumRetweetsnumberOptionalMinimum retweet count
minimumFavoritesnumberOptionalMinimum like count
minimumRepliesnumberOptionalMinimum reply count
startstringOptionalTweets after this date (YYYY-MM-DD)
endstringOptionalTweets before this date (YYYY-MM-DD)
includeSearchTermsbooleanOptionalfalseAdd the matched search term to each tweet
customMapFunctionstringOptionalJavaScript function to transform each output object

Workflow

Progress:
- [ ] Step 1: Define topic and sentiment scope
- [ ] Step 2: Collect tweets via search
- [ ] Step 3: Classify sentiment per tweet
- [ ] Step 4: Identify themes per sentiment bucket
- [ ] Step 5: Deliver sentiment report

Step 1: Clarify Parameters

Ask the user for:

  • Topic, keyword, or brand to analyze
  • Date range (default: last 7 days — Twitter sentiment data decays fast)
  • Language (default: English)
  • Sample size (default: 500 tweets — sufficient for reliable distribution)
  • Exclude retweets? (default: yes — reduces duplicated opinion signals)
  • Comparison topic (optional — for side-by-side sentiment comparison)

Step 2: Collect Tweets

Recommended — run_actor.js (handles waiting, output, and file saving automatically):

# Quick answer (prints table to chat)
node scripts/run_actor.js \
  --actor "apidojo~tweet-scraper" \
  --input '{"param": "value"}'

# Save as CSV
node scripts/run_actor.js \
  --actor "apidojo~tweet-scraper" \
  --input '{"param": "value"}' \
  --output YYYY-MM-DD_results.csv --format csv

# Save as JSON
node scripts/run_actor.js \
  --actor "apidojo~tweet-scraper" \
  --input '{"param": "value"}' \
  --output YYYY-MM-DD_results.json --format json

APIFY_TOKEN must be set in environment or .env file.

If Apify MCP is available:

Tool: apify:run-actor
Actor: "apidojo~tweet-scraper"
Input:
{
  "searchTerms": ["[TOPIC_KEYWORD]"],
  "maxItems": 500,
  "tweetLanguage": "en",
  "since": "[YYYY-MM-DD]",
  "until": "[YYYY-MM-DD]"
}

REST API fallback:

curl -X POST \
  "https://api.apify.com/v2/acts/apidojo~tweet-scraper/runs?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "searchTerms": ["[TOPIC_KEYWORD]"],
    "maxItems": 500,
    "tweetLanguage": "en",
    "since": "[YYYY-MM-DD]"
  }'

Step 3: Classify Sentiment

For each tweet's text, classify as Positive, Negative, or Neutral using lexical signals:

Positive indicators: love, great, amazing, perfect, best, win, excited, congrats, excellent, recommend, beautiful, proud, happy, thank, awesome, incredible Negative indicators: hate, awful, worst, terrible, broken, scam, disappointed, angry, frustrated, disgusted, avoid, never again, shame, sad, fail, wrong, bad Strong negative amplifiers: "can't believe", "what a joke", "are you serious", "wtf", "this is ridiculous" Neutral default: Everything else

For ambiguous cases, use emoji signals:

  • 😍🥰❤️🙌👏✨🔥 → lean Positive
  • 😡🤬😤💀🗑️🤢👎 → lean Negative
  • 🤔😐🤷 → lean Neutral

Weight tweets by engagement: a tweet with 1,000 likes carries more signal than one with 0.

Step 4: Theme Extraction

For Negative tweets: identify the top 3-5 recurring nouns/themes. What are people upset about specifically? For Positive tweets: identify the top 3-5 recurring praise themes.

Look for proper nouns (people, places, products), specific events, or feature names that appear repeatedly.

Step 5: Format Report

Output Format

# Twitter Sentiment Analysis: "[TOPIC]"
Period: [DATE_RANGE] | Tweets analyzed: [N] | Date: [DATE]

## Overall Sentiment

████████████░░░░░░░░ Positive: [X%] ([N] tweets) ████░░░░░░░░░░░░░░░░ Negative: [X%] ([N] tweets) ██████████░░░░░░░░░░ Neutral: [X%] ([N] tweets)


Weighted by engagement:
- Positive sentiment accounts for [X%] of total likes/RTs
- Negative sentiment accounts for [X%] of total likes/RTs

**Overall verdict:** [Mostly Positive / Mixed / Mostly Negative / Polarized]

## Top Negative Themes
1. "[Theme]" — [N] tweets, [N] total likes
   Example: "@[handle]: [tweet excerpt]"
2. "[Theme]" — [N] tweets
3. "[Theme]" — [N] tweets

## Top Positive Themes
1. "[Theme]" — [N] tweets, [N] total likes
   Example: "@[handle]: [tweet excerpt]"
2. "[Theme]" — [N] tweets

## Most Engaged Tweets
🔴 Most-liked negative: @[handle] ([N] likes): "[excerpt]"
🟢 Most-liked positive: @[handle] ([N] likes): "[excerpt]"

## Volume Over Time
[Day 1]: [N] tweets | [Day 2]: [N] tweets | [Day 3]: [N] tweets

## Notable Spikes
[Date with highest volume] — [N] tweets | Likely cause: [describe if detectable from tweet context]

Troubleshooting

Sentiment feels inaccurate: Lexical analysis misses sarcasm. For high-stakes decisions, manually review the top 20 tweets per bucket. Topic too broad: Narrow the search term. "Apple" returns tech and food — use "Apple iPhone" instead. Very low tweet volume: Topic may not be actively discussed on Twitter right now. Expand date range.

Related skills

Tracks sports team fan sentiment on Twitter using apidojo's Tweet scraper. Triggers when the user asks to: track fan sentiment about a sports team on Twitter, monitor Twitter reactions to sports team news, analyze fan mood after a game result on Twitter, measure public sentiment around a sports team, monitor Twitter buzz around a sports event, analyze fan reactions to player trades or news, or build a sentiment tracker for a sports team's social media presence. Returns sentiment distribution, volume trends, top fan reactions, topic themes, and event-triggered spikes. Ideal for sports marketing teams, brand sponsors, sports analytics firms, and sports media companies.

1 installs

Tracks brand sentiment across Twitter Reddit and TikTok simultaneously using apidojo's scrapers on Apify. Triggers when the user asks to: monitor brand reputation across social platforms, track how people talk about a brand on multiple channels, compare brand sentiment on Twitter vs Reddit vs TikTok, get a cross-platform brand health score, monitor a product launch reaction across social media, measure overall public sentiment for a brand, or build a multi-platform social listening dashboard for a brand. Returns per-platform sentiment distribution, cross-platform score, top positive/negative posts, and theme analysis. Ideal for brand managers, CMOs, PR teams, and reputation management agencies.

1 installs

Tracks product launch buzz and reactions on Twitter using apidojo's Twitter Search scraper. Triggers when the user asks to: track product launch buzz on Twitter, monitor Twitter reactions to a product launch, measure product launch sentiment on X, find tweets about a new product release, track how a product launch is being received on Twitter, monitor competitor product announcements on Twitter, or analyze the social media impact of a product launch. Returns tweet volume, sentiment distribution, top voices, geographic spread, and buzz score. Ideal for product marketing teams, PR professionals, and competitive analysts monitoring launches.

1 installs

Monitors and aggregates brand mentions on Twitter/X using apidojo's Tweet and Search scrapers on Apify. Triggers when the user asks to: track mentions of a brand on Twitter, find what people are saying about a company on X, monitor brand sentiment on Twitter, set up brand mention tracking, find customer complaints or praise about a product on Twitter, analyze brand reputation based on tweets, or measure share of voice on X compared to competitors. Returns tweet text, author, engagement metrics, sentiment signals, and timestamps per mention. Ideal for brand managers, PR teams, community managers, and reputation analysts.

1 installs

Monitors trending topics and conversations in a specific niche on Twitter using apidojo's Twitter Search scraper. Triggers when the user asks to: monitor trending topics in a niche on Twitter, track what's being discussed in an industry on X right now, find emerging conversations in a sector on Twitter, see what topics are trending in a specific community, track real-time buzz around a business topic on Twitter, or identify breaking trends before they hit mainstream media. Returns trending topics, tweet velocity, engagement signals, and top voices in the trend. Ideal for social media managers, PR teams, and real-time content strategists.

1 installs

Extracts and analyzes tweet history from competitor or brand Twitter profiles using apidojo's Twitter Profile Scraper on Apify. Triggers when the user asks to: get all tweets from a competitor's Twitter account, analyze what a company posts on Twitter, audit a brand's tweet history, track what topics a competitor covers on X, compare Twitter content strategy between brands, extract posts from a company's Twitter timeline, or monitor a competitor's messaging and announcements on Twitter. Returns tweet text, engagement metrics (likes, retweets, replies, views), and author data. Ideal for competitive intelligence teams, PR analysts, and brand strategists.

1 installs