monitoring-brand-mentions-on-twitter

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Monitoring Brand Mentions on Twitter

监控Twitter上的品牌提及内容

Collects all public tweets mentioning a brand, product, or keyword on Twitter/X within a date range. Groups by sentiment, surfaces top complaints and praise, and provides engagement totals.
收集指定日期范围内Twitter/X上所有提及品牌、产品或关键词的公开推文。按舆情分类,展示最受关注的投诉与好评,并提供总互动数据。

Prerequisites

前置条件

  • APIFY_TOKEN
    environment variable set
  • Optional: Apify MCP server installed
  • 已设置
    APIFY_TOKEN
    环境变量
  • 可选:已安装Apify MCP服务器

Inputs

输入参数

ParameterTypeRequiredDefaultNotes
searchTerms
array
[]
Twitter advanced search queries (e.g.
["#AI lang:en", "from:NASA"]
)
sort
stringOptional
Top
Sort order:
Latest
,
Top
, or
Latest+Top
tweetLanguage
stringOptionalISO 639-1 language code (e.g.
en
)
maxItems
numberOptionalUnlimitedMaximum tweets to return
onlyVerifiedUsers
booleanOptional
false
Only tweets from verified users
onlyTwitterBlue
booleanOptional
false
Only Twitter Blue subscribers
onlyImage
booleanOptional
false
Only tweets with images
onlyVideo
booleanOptional
false
Only tweets with videos
onlyQuote
booleanOptional
false
Only quote tweets
author
stringOptionalFilter to a specific author handle
inReplyTo
stringOptionalTweets replying to a specific handle
mentioning
stringOptionalTweets mentioning a specific handle
geotaggedNear
stringOptionalTweets near a location
withinRadius
stringOptionalRadius around geotaggedNear
geocode
stringOptionalLat/lng + radius string
placeObjectId
stringOptionalTweets tagged with a place
minimumRetweets
numberOptionalMinimum retweet count
minimumFavorites
numberOptionalMinimum like count
minimumReplies
numberOptionalMinimum reply count
start
stringOptionalTweets after this date (YYYY-MM-DD)
end
stringOptionalTweets before this date (YYYY-MM-DD)
includeSearchTerms
booleanOptional
false
Add the matched search term to each tweet
customMapFunction
stringOptionalJavaScript function to transform each output object
ParameterTypeRequiredDefaultNotes
searchTerms
array
[]
Twitter高级搜索查询语句(例如
["#AI lang:en", "from:NASA"]
sort
stringOptional
Top
排序方式:
Latest
Top
Latest+Top
tweetLanguage
stringOptionalISO 639-1语言代码(例如
en
maxItems
numberOptionalUnlimited最多返回的推文数量
onlyVerifiedUsers
booleanOptional
false
仅保留已验证用户的推文
onlyTwitterBlue
booleanOptional
false
仅保留Twitter Blue订阅用户的推文
onlyImage
booleanOptional
false
仅保留含图片的推文
onlyVideo
booleanOptional
false
仅保留含视频的推文
onlyQuote
booleanOptional
false
仅保留引用推文
author
stringOptional筛选特定作者的推文(账号名)
inReplyTo
stringOptional筛选回复特定账号的推文
mentioning
stringOptional筛选提及特定账号的推文
geotaggedNear
stringOptional筛选指定地点附近的推文
withinRadius
stringOptional
geotaggedNear
指定地点的半径范围
geocode
stringOptional经纬度+半径字符串
placeObjectId
stringOptional筛选标记特定地点的推文
minimumRetweets
numberOptional最小转发量
minimumFavorites
numberOptional最小点赞量
minimumReplies
numberOptional最小回复量
start
stringOptional此日期之后的推文(格式:YYYY-MM-DD)
end
stringOptional此日期之前的推文(格式:YYYY-MM-DD)
includeSearchTerms
booleanOptional
false
为每条推文添加匹配的搜索关键词
customMapFunction
stringOptional用于转换每个输出对象的JavaScript函数

Workflow

工作流程

Progress:
- [ ] Step 1: Define brand terms and date range
- [ ] Step 2: Run tweet-scraper
- [ ] Step 3: Retrieve dataset
- [ ] Step 4: Classify sentiment (positive/negative/neutral)
- [ ] Step 5: Deliver structured report
Progress:
- [ ] Step 1: Define brand terms and date range
- [ ] Step 2: Run tweet-scraper
- [ ] Step 3: Retrieve dataset
- [ ] Step 4: Classify sentiment (positive/negative/neutral)
- [ ] Step 5: Deliver structured report

Step 1: Clarify Parameters

步骤1:确认参数

Ask the user for:
  • Brand terms — brand name, handle, product name, hashtag, and common misspellings. Build a list. Example:
    ["@Nike", "Nike", "#Nike", "Nike shoes"]
  • Date range — e.g., "last 7 days" or specific dates
  • Exclude retweets? (default: yes — filters noise)
  • Min engagement (optional — e.g., tweets with ≥10 likes only)
  • Language (default: all)
向用户确认以下信息:
  • 品牌关键词 — 品牌名称、账号名、产品名称、话题标签及常见拼写错误,整理成列表。 示例:
    ["@Nike", "Nike", "#Nike", "Nike shoes"]
  • 日期范围 — 例如“过去7天”或具体日期
  • 是否排除转发?(默认:是 — 过滤无效信息)
  • 最低互动量(可选 — 例如仅保留点赞≥10的推文)
  • 语言(默认:所有语言)

Step 2: Run tweet-scraper

步骤2:运行tweet-scraper

Run once per major search term to maximize coverage. Combine results after.
Recommended — run_actor.js (handles waiting, output, and file saving automatically):
bash
undefined
针对每个主要搜索关键词分别运行,以扩大覆盖范围。之后合并结果。
推荐方式 — run_actor.js(自动处理等待、输出和文件保存):
bash
undefined

Quick answer (prints table to chat)

快速输出(在聊天窗口打印表格)

node scripts/run_actor.js
--actor "apidojo~tweet-scraper"
--input '{"param": "value"}'
node scripts/run_actor.js
--actor "apidojo~tweet-scraper"
--input '{"param": "value"}'

Save as CSV

保存为CSV

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

Save as JSON

保存为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": ["[BRAND_TERM]"], "maxItems": 500, "includeReplies": true, "tweetLanguage": "en", "since": "[YYYY-MM-DD]", "until": "[YYYY-MM-DD]" }

**If Apify MCP is not available:**
```bash
curl -X POST \
  "https://api.apify.com/v2/acts/apidojo~tweet-scraper/runs?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "searchTerms": ["[BRAND_TERM]"],
    "maxItems": 500,
    "includeReplies": true,
    "since": "[YYYY-MM-DD]",
    "until": "[YYYY-MM-DD]"
  }'
Run for each brand term in the list. Wait for
SUCCEEDED
, collect all results.
node scripts/run_actor.js
--actor "apidojo~tweet-scraper"
--input '{"param": "value"}'
--output YYYY-MM-DD_results.json --format json
> 需在环境变量或`.env`文件中设置`APIFY_TOKEN`。

**若Apify MCP可用:**
Tool: apify:run-actor Actor: "apidojo~tweet-scraper" Input: { "searchTerms": ["[BRAND_TERM]"], "maxItems": 500, "includeReplies": true, "tweetLanguage": "en", "since": "[YYYY-MM-DD]", "until": "[YYYY-MM-DD]" }

**若Apify MCP不可用:**
```bash
curl -X POST \
  "https://api.apify.com/v2/acts/apidojo~tweet-scraper/runs?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "searchTerms": ["[BRAND_TERM]"],
    "maxItems": 500,
    "includeReplies": true,
    "since": "[YYYY-MM-DD]",
    "until": "[YYYY-MM-DD]"
  }'
针对列表中的每个品牌关键词运行。等待任务状态变为
SUCCEEDED
后,收集所有结果。

Step 3: Fetch and Merge Results

步骤3:获取并合并结果

bash
curl "https://api.apify.com/v2/actor-runs/$RUN_ID/dataset/items?token=$APIFY_TOKEN"
Merge datasets from all runs. Deduplicate by tweet
id
. Result: unified list of all mentions.
bash
curl "https://api.apify.com/v2/actor-runs/$RUN_ID/dataset/items?token=$APIFY_TOKEN"
合并所有任务运行的数据集,按推文
id
去重。最终得到统一的品牌提及列表。

Step 4: Classify Sentiment

步骤4:舆情分类

For each tweet's
text
field, apply a simple classification pass:
Positive signals: words like "love", "great", "amazing", "best", "recommend", "thank", "perfect" Negative signals: words like "hate", "awful", "broken", "scam", "worst", "never again", "disappointed", "avoid" Neutral: everything else (announcements, news, questions)
Group tweets into three buckets: Positive, Negative, Neutral.
Identify top 5 most-engaged negative tweets (these need the fastest response). Identify top 5 most-engaged positive tweets (retweet candidates / testimonial material).
针对每条推文的
text
字段,执行简单分类:
正面信号: 包含“love”、“great”、“amazing”、“best”、“recommend”、“thank”、“perfect”等词汇 负面信号: 包含“hate”、“awful”、“broken”、“scam”、“worst”、“never again”、“disappointed”、“avoid”等词汇 中性: 其他内容(公告、新闻、问题等)
将推文分为三类:正面、负面、中性。
找出互动量最高的5条负面推文(这些需要最快响应)。 找出互动量最高的5条正面推文(可作为转发素材或客户证言)。

Step 5: Format Report

步骤5:生成报告

Use the output template below.
使用以下输出模板。

Output Format

输出格式

undefined
undefined

Brand Mention Report: [BRAND]

Brand Mention Report: [BRAND]

Period: [START_DATE] – [END_DATE] | Total mentions: [N] | Analyzed: [DATE]
Period: [START_DATE] – [END_DATE] | Total mentions: [N] | Analyzed: [DATE]

Sentiment Summary

Sentiment Summary

SentimentCount% of TotalAvg Engagement
Positive[N][X%][likes+RT avg]
Negative[N][X%][likes+RT avg]
Neutral[N][X%][likes+RT avg]
SentimentCount% of TotalAvg Engagement
Positive[N][X%][likes+RT avg]
Negative[N][X%][likes+RT avg]
Neutral[N][X%][likes+RT avg]

🔴 Top Negative Mentions (Action Required)

🔴 Top Negative Mentions (Action Required)

  1. @[handle] ([likes] likes): "[tweet text excerpt]" → [url]
  2. @[handle] ([likes] likes): "[tweet text excerpt]" → [url]
  3. @[handle] ([likes] likes): "[tweet text excerpt]" → [url]
  1. @[handle] ([likes] likes): "[tweet text excerpt]" → [url]
  2. @[handle] ([likes] likes): "[tweet text excerpt]" → [url]
  3. @[handle] ([likes] likes): "[tweet text excerpt]" → [url]

🟢 Top Positive Mentions (Amplify These)

🟢 Top Positive Mentions (Amplify These)

  1. @[handle] ([likes] likes): "[tweet text excerpt]" → [url]
  2. @[handle] ([likes] likes): "[tweet text excerpt]" → [url]
  3. @[handle] ([likes] likes): "[tweet text excerpt]" → [url]
  1. @[handle] ([likes] likes): "[tweet text excerpt]" → [url]
  2. @[handle] ([likes] likes): "[tweet text excerpt]" → [url]
  3. @[handle] ([likes] likes): "[tweet text excerpt]" → [url]

Volume Over Time

Volume Over Time

[Day 1]: [N] mentions | [Day 2]: [N] mentions | [Day 3]: [N] mentions...
[Day 1]: [N] mentions | [Day 2]: [N] mentions | [Day 3]: [N] mentions...

Key Themes in Negative Mentions

Key Themes in Negative Mentions

  • [Theme 1]: [N] tweets (e.g., "shipping delays")
  • [Theme 2]: [N] tweets (e.g., "customer service")
  • [Theme 1]: [N] tweets (e.g., "shipping delays")
  • [Theme 2]: [N] tweets (e.g., "customer service")

Key Themes in Positive Mentions

Key Themes in Positive Mentions

  • [Theme 1]: [N] tweets
  • [Theme 2]: [N] tweets
undefined
  • [Theme 1]: [N] tweets
  • [Theme 2]: [N] tweets
undefined

Troubleshooting

故障排除

Too many results for popular brands: Increase
minLikes
filter to 5 or 10 to focus on influential mentions. Missing mentions: Twitter search API has ~7-10 day lookback limit for free tier. For historical data, reduce date range. Sentiment misclassification: Sarcasm is hard to catch with keyword matching — flag high-engagement tweets for manual review.
热门品牌结果过多:
minLikes
筛选条件提高至5或10,聚焦有影响力的提及内容。 遗漏提及内容: Twitter搜索API免费版的回溯期约为7-10天。如需历史数据,请缩小日期范围。 舆情分类错误: 基于关键词匹配难以识别讽刺内容 — 标记高互动量推文进行人工审核。