# TikTok Comments for AI Sentiment Analysis & RAG

**Use case:** 

Group TikTok comments and nested replies into structured Markdown thread documents with sentiment hints and engagement stats for LLMs and RAG.

## Input

```json
{
  "postURLs": [
    "https://www.tiktok.com/@tiktok/video/7106594312292453675"
  ],
  "profiles": [],
  "maxVideosPerProfile": 5,
  "maxComments": 100,
  "includeReplies": true,
  "maxRepliesPerComment": 10,
  "outputMode": "rag",
  "sortBy": "Top",
  "onlyPurchaseIntent": false,
  "onlyQuestions": false,
  "keywordFilter": [],
  "languageFilter": [],
  "minLikes": 0,
  "minReplies": 0,
  "enrichCommenterProfiles": false,
  "maxEnrichedProfiles": 100,
  "maxConcurrency": 3,
  "deliverTarget": "",
  "deliverMode": "summary",
  "deliverMaxItems": 25,
  "businessCommentStatus": "ALL",
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

## Output

```json
{
  "cid": {
    "label": "Comment ID",
    "format": "string"
  },
  "threadTitle": {
    "label": "Thread Title (RAG)",
    "format": "string"
  },
  "commentCount": {
    "label": "Thread Comment Count (RAG)",
    "format": "integer"
  },
  "totalLikes": {
    "label": "Thread Total Likes (RAG)",
    "format": "integer"
  },
  "purchaseIntentCount": {
    "label": "Thread Purchase Intent Count (RAG)",
    "format": "integer"
  },
  "questionCount": {
    "label": "Thread Question Count (RAG)",
    "format": "integer"
  },
  "ragText": {
    "label": "RAG Markdown Document",
    "format": "string"
  },
  "videoCaption": {
    "label": "Video Caption",
    "format": "string"
  },
  "videoUrl": {
    "label": "Canonical Post URL",
    "format": "string"
  }
}
```

## How it works

### 1. Sign up on Apify or log in

The TikTok Comments Scraper — Bulk, Profiles, Server API & MCP Actor is ready to run with the inputs already set for "TikTok Comments for AI Sentiment Analysis & RAG". [Sign up or log in](https://console.apify.com/create-task-from-example/R3Mo7X7tIMbpgQrSg) and you'll land in Apify Console with a copy of this exact task.

### 2. Start the "TikTok Comments for AI Sentiment Analysis & RAG" task

The TikTok Comments Scraper — Bulk, Profiles, Server API & MCP Actor will start running based on the input automatically. You can also change all the input fields, like 🔗 tiktok video / photo urls, 👤 tiktok profile usernames or urls (bulk discovery), and more, to match your specific use case.

### 3. Receive the "TikTok Comments for AI Sentiment Analysis & RAG" output

Monitor the progress in real time. You will be notified as soon as your dataset is complete and ready for review. Each result includes data such as comment id, thread title (rag), thread comment count (rag), and more.

### 4. Integrate into your workflow

The final output is delivered in JSON, CSV, or Excel format, ready to be plugged into your workflow. You can also [run the "TikTok Comments for AI Sentiment Analysis & RAG" task via API](https://apify.com/forlex/tiktok-comments-scraper.md).

## FAQ

### What does TikTok Comments for AI Sentiment Analysis & RAG output?

TikTok Comments for AI Sentiment Analysis & RAG outputs one Markdown ragText document per thread combining parent comment, replies, and engagement metrics.

### Why use RAG mode instead of flat rows for LLM analysis?

TikTok Comments for AI Sentiment Analysis & RAG preserves full conversation context between parent comments and replies so LLMs analyze threads accurately.

### Are sentiment and question metrics precomputed in RAG mode?

TikTok Comments for AI Sentiment Analysis & RAG precomputes purchaseIntentCount, questionCount, totalLikes, and topCommenters on every thread document.

## About this Actor

This example demonstrates how to use [TikTok Comments Scraper — Bulk, Profiles, Server API & MCP](https://apify.com/forlex/tiktok-comments-scraper.md) with a specific input configuration. Visit the [Actor detail page](https://apify.com/forlex/tiktok-comments-scraper.md) to learn more, explore other use cases, and run it yourself.


## How to integrate an Actor?

This Task's input is already configured above. Use it as-is rather than inventing a new one.

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 full API examples (JavaScript, Python, CLI, MCP, OpenAPI), see this Task's Actor page: https://apify.com/forlex/tiktok-comments-scraper.md

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`).
