# Telegram Comments Scraper (`signalharvest/telegram-comments-scraper`) Actor

Export public comments under Telegram channel posts with reply threads, reactions and post context. Only-new mode catches fresh comments under old posts. Author names off by default. No login, no API key.

- **URL**: https://apify.com/signalharvest/telegram-comments-scraper.md
- **Developed by:** [SignalHarvest](https://apify.com/signalharvest) (community)
- **Categories:** Social media, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.09 / 1,000 comments

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## 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

## Telegram Comments Scraper

Export public comments under Telegram channel posts: text, date, reply threads and reactions. No Telegram account, phone number, bot token or API key is needed.

### What you get

- Every public comment under a post, not only the first page
- Reply threads: each comment carries the ID of the comment it answers, the root of its thread and the number of replies it got
- Post context next to every comment: channel title, post text and views
- **Only new comments** mode for scheduled runs: each run returns only comments you have not received before, including new comments under old posts
- Pick posts by keywords: collect comments only under posts that mention your words
- Reactions per comment with counts
- Direct link to every comment
- Batch mode: pass channels and the Actor checks their latest posts for you
- Author names are off by default and can be switched on when you need them

### Use cases

- **Audience reaction to a post.** Export everything people wrote under an announcement, a news post or a contest, with reply threads and reactions.
- **Community and support monitoring.** Run the Actor on a schedule with **Only new comments** and receive only fresh comments under the latest posts of your channels, including late comments under older posts.
- **Reaction to a topic.** Pick posts by keywords, for example every post that mentions a listing or an outage, and collect the discussion under them.
- **Research without personal data.** Author names are off by default: you get what was said, in which thread and how people reacted, without profiles.

### Input

| Field | Description |
|---|---|
| `postUrls` | Links to posts, for example `https://t.me/contest/462` |
| `channels` | Public channels: `@username`, `username` or `https://t.me/username` |
| `maxPostsPerChannel` | How many latest posts to check in each channel (default 20) |
| `postsFrom`, `postsTo` | Optional date range for channel posts, UTC |
| `postKeywords` | For `channels`: only posts whose text contains any of these words or phrases, case-insensitive |
| `excludePostKeywords` | For `channels`: skip posts whose text contains any of these words or phrases |
| `maxCommentsPerPost` | Keep the newest N comments per post (default 500) |
| `onlyNewComments` | Return only comments that appeared after your previous runs for the same post (default off) |
| `includePostContext` | Add `channelTitle`, `postText` and `postViews` to every comment (default on) |
| `includeAuthors` | Add author display name and username (default off) |

Provide `postUrls`, `channels`, or both.

```json
{
    "channels": ["@binance_announcements"],
    "maxPostsPerChannel": 10,
    "maxCommentsPerPost": 200
}
```

```json
{
    "channels": ["@binance_announcements"],
    "postKeywords": ["listing", "delist"],
    "excludePostKeywords": ["giveaway"],
    "onlyNewComments": true
}
```

### Output

One dataset item per comment:

```json
{
    "channel": "contest",
    "channelTitle": "Telegram Contests",
    "postId": 462,
    "postUrl": "https://t.me/contest/462",
    "postDate": "2026-09-05T12:00:00+00:00",
    "postText": "Text of the parent post",
    "postViews": 125000,
    "commentId": 277446,
    "commentUrl": "https://t.me/contest/462?comment=277446",
    "text": "Comment text",
    "date": "2026-09-06T13:56:18+00:00",
    "replyToId": 277445,
    "threadRootId": 277440,
    "repliesCount": 2,
    "reactions": [{ "emoji": "❤", "count": 3 }],
    "reactionsCount": 3
}
```

- `channelTitle`, `postText` and `postViews` describe the parent post. For direct `postUrls` they cost one extra request per post and are `null` when the channel has no public preview; `postDate` is filled the same way. Turn `includePostContext` off to leave them out.
- `repliesCount` is the number of direct replies to the comment. `threadRootId` is the top comment of its thread; for a comment that answers nobody it equals `commentId`. Both are counted over the comments collected in the run, so with `maxCommentsPerPost` or `onlyNewComments` cutting older comments off, `threadRootId` is the oldest ancestor that is known.
- With `includeAuthors` enabled, items also contain `authorName` and `authorUsername`.

A run summary is saved to the key-value store under `SUMMARY`: posts processed, posts without a discussion, posts without new comments, channels skipped and why.

### Picking posts by keywords

With `postKeywords`, the Actor runs Telegram's own in-channel search for every keyword and keeps posts whose visible text contains the keyword. Telegram returns only about 22 newest matching posts per keyword in a channel, so older matches are not reached. `excludePostKeywords` works with or without `postKeywords`. Both apply to `channels` only; posts given in `postUrls` are always processed.

### Monitoring with "Only new comments"

Turn on `onlyNewComments` and run the Actor on a schedule. For every post the Actor remembers the newest comment it returned in a named key-value store, `telegram-comments-state`, in your Apify account. The next run returns only newer comments. The first run returns the comments as usual and sets the starting point.

- New comments under old posts are found as long as the post is still among the posts the run checks: keep `maxPostsPerChannel` and the date range wide enough, or list the posts in `postUrls`.
- The state is shared by all runs of this Actor in your account that process the same post. To start over, delete the `telegram-comments-state` store.
- The first run keeps the newest `maxCommentsPerPost` comments of each post. Later runs return new comments oldest first: when more than `maxCommentsPerPost` appeared, or your spending limit stopped the run, the rest comes in the next run.

### Run it from your code or a no-code tool

Get comments in one HTTP call. Replace `<APIFY_TOKEN>` with your token from Apify Console (Settings, API & Integrations):

```bash
curl -X POST "https://api.apify.com/v2/acts/signalharvest~telegram-comments-scraper/run-sync-get-dataset-items" \
  -H "Authorization: Bearer <APIFY_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"postUrls": ["https://t.me/contest/462"], "maxCommentsPerPost": 100}'
```

The response is the JSON array described in Output. Add `?format=csv` to the address to get a CSV file instead.

To receive new comments without writing code: save your input with `onlyNewComments` turned on as a task in Apify Console, choose how often to run it on the task's **Schedules** tab, and on the **Integrations** tab connect Slack, Google Sheets, Make, n8n or Zapier, or add a webhook for the "Run succeeded" event. The webhook receives the run's `defaultDatasetId`; the comments are at `https://api.apify.com/v2/datasets/<defaultDatasetId>/items`.

### Limits

- Only channels where comments are enabled. If the three latest posts of a channel have no discussion, the channel is skipped and listed in the summary.
- Only public channels with a web preview. Private channels and channels that disabled the preview are skipped.
- Comments that consist only of media come with an empty `text`.
- The comment count shown by Telegram can be slightly higher than the number returned: deleted comments are still counted there.

### Changelog

- **0.1.6, 16 November 2026.** Post context next to every comment (`channelTitle`, `postText`, `postViews`), `repliesCount` and `threadRootId`, post selection by `postKeywords` and `excludePostKeywords`, **Only new comments** mode for scheduled runs.

### Personal data

Comment text is public, but author names and usernames are personal data. They are excluded unless you turn on `includeAuthors`. Make sure you have a lawful basis for processing them and follow the rules that apply to you, including GDPR.

Do not use the output to train or fine-tune AI models: Telegram's terms prohibit it.

# Actor input Schema

## `postUrls` (type: `array`):

Links to channel posts, for example https://t.me/telegram/123. Comments are collected for each post.

## `channels` (type: `array`):

Public channels as @username, username or https://t.me/username. The latest posts of each channel are checked for comments.

## `maxPostsPerChannel` (type: `integer`):

How many latest posts to check in each channel.

## `postsFrom` (type: `string`):

Only posts published on or after this date (UTC).

## `postsTo` (type: `string`):

Only posts published on or before this date (UTC).

## `postKeywords` (type: `array`):

For Channels: collect comments only for posts whose text contains any of these words or phrases (case-insensitive). Uses Telegram's in-channel search, which returns about 22 newest matching posts per keyword.

## `excludePostKeywords` (type: `array`):

For Channels: skip posts whose text contains any of these words or phrases (case-insensitive), for example ad or giveaway.

## `maxCommentsPerPost` (type: `integer`):

The newest comments are kept when a post has more than this number.

## `onlyNewComments` (type: `boolean`):

Return only comments that appeared after your previous runs for the same post, including new comments under old posts. Use it with a schedule to monitor discussions.

## `includePostContext` (type: `boolean`):

Add the channel title and the text and views of the parent post to every comment. For Post URLs this costs one extra request per post.

## `includeAuthors` (type: `boolean`):

Add the display name and username of each comment author. Off by default: these are personal data, enable only if you have a lawful basis to process them.

## Actor input object example

```json
{
  "postUrls": [
    "https://t.me/contest/462"
  ],
  "maxPostsPerChannel": 20,
  "maxCommentsPerPost": 500,
  "onlyNewComments": false,
  "includePostContext": true,
  "includeAuthors": false
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# 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 = {
    "postUrls": [
        "https://t.me/contest/462"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("signalharvest/telegram-comments-scraper").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 = { "postUrls": ["https://t.me/contest/462"] }

# Run the Actor and wait for it to finish
run = client.actor("signalharvest/telegram-comments-scraper").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 '{
  "postUrls": [
    "https://t.me/contest/462"
  ]
}' |
apify call signalharvest/telegram-comments-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,signalharvest/telegram-comments-scraper"
        }
    }
}
```

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/1Je0fs4DlvNdH5OSa/builds/8qefh63m9LPJEcuPt/openapi.json
