# YouTube Comment Brand Monitor → Slack Alerts & Sentiment (`supersuper/youtube-comment-brand-monitor`) Actor

RoBERTa sentiment + composite risk (likes/replies/thread), 7/30/90d or custom window, paginated keyword search or comment scan, Slack on new negatives. No YouTube login.

- **URL**: https://apify.com/supersuper/youtube-comment-brand-monitor.md
- **Developed by:** [SS HH](https://apify.com/supersuper) (community)
- **Categories:** Marketing, Social media, AI
- **Stats:** 2 total users, 1 monthly users, 91.7% runs succeeded, 2 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## YouTube Comment Brand Monitor → Slack Alerts & Sentiment

Catch negative brand mentions on YouTube **before they spread**. Search by keyword (no URL needed) or scan comments under videos you paste. Each hit is scored with **Twitter-RoBERTa** plus **likes / reply-thread size / thread negativity**, filtered by a **7 / 30 / 90-day or custom** window, then Slack-alerted only when it’s **new and negative enough**.

No YouTube login. Schedule it and sleep.

### Why this Actor (not a keyword toy)

- **RoBERTa sentiment** — CardiffNLP Twitter-RoBERTa (social-trained), not a hand-maintained word list
- **Composite risk score** — blends text intensity + engagement + reply-thread size + reply-thread negativity
- **Time windows** — Last 7 / 30 / 90 days, custom `YYYY-MM-DD` range, or no limit (future dates rejected / clamped)
- **Search pagination** — keyword search keeps flipping pages until it hits your `maxResults` cap
- **Two modes** — keyword → videos, or paste URLs → comment scan + reply sampling
- **Negative-first Slack** — webhook fires only for new mentions past your threshold
- **No YouTube login** — public data via `youtubei.js`

### Who it’s for

- Founders watching launch chatter under review / unboxing videos
- Small PR / marketing teams without Brandwatch budgets
- Automation builders piping mention events into Slack / Sheets / CRM

### What you get (dataset)

| Field | Meaning |
|-------|---------|
| `source` | `youtube` |
| `keyword` | which brand term matched |
| `title`, `text`, `url` | content + deep link |
| `author`, `community` | who / where |
| `engagement` | likes (comments) or views (search hits) |
| `commentCount` | reply-thread size |
| `sentimentLabel` | `negative` / `neutral` / `positive` |
| `sentimentIntensity` | RoBERTa P(negative) on the parent text |
| `replyConcentration` | mean negativity of sampled replies |
| `sentimentScore` | **composite** negative score (alerts + sort) |
| `riskLevel` | `high` / `medium` / `low` from the composite |
| `isNew` | first time seen for this monitor config |
| `publishedAt`, `checkedAt` | timing |

#### How `sentimentScore` is built

```
0.50 × text intensity
+ 0.20 × intensity × engagementNorm   (log-scaled likes/views)
+ 0.15 × intensity × threadNorm       (log-scaled reply count)
+ 0.15 × replyConcentration           (sampled reply negativity)
```

First cloud run downloads the ONNX model into cache (slower once); later runs reuse it.

### How to run

1. Enter brand **keywords** (search paginates until `maxResults`), or paste **YouTube video URLs** + keywords (comment scan).
2. Pick a **Time range** (default: last 30 days).
3. First run without Slack — inspect the dataset (sorted worst-first).
4. Tune `minimumEngagement` / `negativeThreshold` if noisy.
5. Add Slack webhook, then schedule with `onlyNewMentions: true`.

#### Example input

```json
{
  "keywords": ["iPhone"],
  "youtubeVideoUrls": [],
  "lookbackPreset": "30",
  "maxResultsPerSource": 50,
  "negativeThreshold": 0.65,
  "minimumEngagement": 1,
  "onlyNewMentions": true,
  "slackWebhookUrl": "https://hooks.slack.com/services/…"
}
```

### Support

Questions or volume pricing: email **coohhh2408@gmail.com**.

# Actor input Schema

## `keywords` (type: `array`):

Required. Drives paginated YouTube search when no video URLs are set, and filters comments when URLs are set.

## `youtubeVideoUrls` (type: `array`):

Optional. Leave empty for keyword search (paginated). Paste URLs to scan that video's comments and sample reply threads for concentration scoring.

## `lookbackPreset` (type: `string`):

Keep only videos/comments inside this window. Differentiator vs open-ended scrapes: 7 / 30 / 90 days, custom dates, or no limit.

## `dateFrom` (type: `string`):

Used when Time range = Custom. Format YYYY-MM-DD. Must not be in the future.

## `dateTo` (type: `string`):

Used when Time range = Custom. Format YYYY-MM-DD. Future dates are clamped to today.

## `maxResultsPerSource` (type: `integer`):

Cap on kept results. Search mode paginates YouTube until this cap (or pages run out). Comment mode: max matching comments across videos.

## `negativeThreshold` (type: `number`):

0–1 on the composite risk score (RoBERTa intensity × engagement/thread). Recommended: 0.65. Higher = fewer, stronger alerts.

## `minimumEngagement` (type: `integer`):

Only Slack-alert when a negative result has at least this many likes (comments) or views (search). Dataset still includes all matches.

## `onlyNewMentions` (type: `boolean`):

Recommended for schedules. Remembers seen IDs so Slack only fires on new hits. Dataset still includes every match in the run.

## `slackWebhookUrl` (type: `string`):

Keep private. Compact alert with risk, composite score, likes, replies, intensity, and thread negativity — only for qualifying new negatives.

## Actor input object example

```json
{
  "keywords": [
    "iPhone"
  ],
  "youtubeVideoUrls": [],
  "lookbackPreset": "30",
  "maxResultsPerSource": 50,
  "negativeThreshold": 0.65,
  "minimumEngagement": 0,
  "onlyNewMentions": true
}
```

# Actor output Schema

## `mentions` (type: `string`):

YouTube search hits or comments with RoBERTa sentiment, composite risk, engagement, and reply-thread signals — sorted worst-first.

## `runSummary` (type: `string`):

Totals for mentions scored and Slack-qualified negative alerts.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "keywords": [
        "iPhone"
    ],
    "youtubeVideoUrls": [],
    "lookbackPreset": "30",
    "maxResultsPerSource": 50,
    "onlyNewMentions": false
};

// Run the Actor and wait for it to finish
const run = await client.actor("supersuper/youtube-comment-brand-monitor").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "keywords": ["iPhone"],
    "youtubeVideoUrls": [],
    "lookbackPreset": "30",
    "maxResultsPerSource": 50,
    "onlyNewMentions": False,
}

# Run the Actor and wait for it to finish
run = client.actor("supersuper/youtube-comment-brand-monitor").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "keywords": [
    "iPhone"
  ],
  "youtubeVideoUrls": [],
  "lookbackPreset": "30",
  "maxResultsPerSource": 50,
  "onlyNewMentions": false
}' |
apify call supersuper/youtube-comment-brand-monitor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,supersuper/youtube-comment-brand-monitor"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/q2QGjXHAFrzRh4BIw/builds/QnjefA67IOYpr3Yfv/openapi.json
