# Telegram Channel Scraper: Posts, Messages, Comments, Search (`data-for-agents/telegram-channel-posts`) Actor

Get posts from public Telegram channels by username or t.me link: text, date, views, reactions, media links, forwards, replies, comments and channel info. Search inside a channel, read full history or a date range, or return only new posts. No login. $0.90 per 1,000 posts; errors are free.

- **URL**: https://apify.com/data-for-agents/telegram-channel-posts.md
- **Developed by:** [Data for Agents](https://apify.com/data-for-agents) (community)
- **Categories:** Social media, Automation
- **Features:** Limited permissions
- **Stats:** 3 total users, 2 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

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 Channel Scraper: posts, messages, views, search

Returns one row per post from public Telegram channels: text, date, views, reactions, media links, polls, forwards, replies, link previews, optional comments, and the channel's title, exact subscriber count and description. Input: channel usernames, @names, t.me links, or links to single posts. Search inside channels, filter by date, views, media type or comments, or return only the posts that are new since the last run. No Telegram account, no login, no API key.

**Price:** $0.90 per 1,000 posts (one `post` event per post returned). Error rows, posts removed by filters and posts already returned in only-new mode are free.

**Tested on Apify** (no proxy, 1,024 MB): 15 public channels, 200 posts each: 2,866 posts in 8.4 seconds (2.95 seconds per 1,000 posts). A 20,000-post scan from one Apify IP: no throttling.

### Pricing

| Event | Price | When |
|---|---|---|
| Post | $0.90 per 1,000 posts | Charged once per post returned. Error rows, posts removed by filters and posts already returned in only-new mode are free. |
| Keyword search | $0.01 per Google results page | Charged only when discoverKeywords is on: one charge per Google results page read (about 10 channels). |
| Media file | $0.003 per file saved | Charged only when downloadMedia is on: one charge per photo, video, voice message or sticker saved (up to 50 MB each). |

### What you can do with it

- **Monitor channels on a schedule.** Turn on *Only new posts since the last run* and schedule the Actor every 10 minutes or every day. Each run returns only what was posted since the previous run, per channel, with no gaps even when a run is cut short.
- **Search inside channels.** Give search terms and a list of channels. Each channel is searched with Telegram's own search, and with *Deep* search depth the Actor also reads the channel's older posts and matches the terms itself, so you get every match, not just the newest 22 that Telegram's search shows.
- **Back-fill history.** Read a channel back to its first post, or only a date range, for example *2025-01-01* to *2025-03-31*, or *30 days*.
- **Filter before you pay.** Only posts with photos or videos, only posts with at least 10,000 views, skip posts with certain words. Posts that do not pass the filters are not charged.
- **Many channels at once.** Channels are read in parallel: 15 channels of 200 posts each (2,866 posts) take about 8 seconds on Apify.
- **Save the media files.** Turn on *Save media files* and each photo, video, voice message and sticker is copied to the run's storage with a lasting link, its file size and type (Telegram's own links expire).
- **Find channels by keyword.** Give topics like `crypto news` in *Find channels by keyword*: the Actor finds Telegram channels for them on Google and reads them with your settings. Rows have `discovered: true` and `discovered_by`. $0.01 per Google results page read (about 10 channels).
- **Cover a whole niche from a few channels.** Set *Also read related channels* and the Actor also reads the channels your channels' posts forward from, link to or mention, with the same search terms and filters.
- **Find related channels.** Every run lists, in its summary, the other channels its posts forward from, link to or mention, with counts: a quick way to discover a niche's neighbouring channels.
- **Re-read known posts.** Give post links and get each post as it is now: views, reactions and comments, for tracking how posts perform over time.

### Input

| Field | What it does |
|---|---|
| Channels | Usernames or links: `durov`, `@durov`, `https://t.me/durov`, `t.me/s/durov`. |
| Exact posts | Post links such as `https://t.me/durov/548`. Each post is returned as it is now. A link to one photo of an album returns the album post. |
| Max posts per channel | How many posts per channel, newest first. With search or filters: how many matching posts. |
| Posts from / Posts until | Date range: `2026-01-31`, `2026-01-31T08:00:00Z`, or relative: `7 days`, `24 hours`, `3 months`. |
| Search terms | Only posts containing these words. Two words need both; `"exact phrase"` in quotes needs the phrase. |
| Search depth | *Deep* (default): every match, reading older posts as needed. *Fast*: Telegram's own search only, about 22 newest matches per term. |
| Whole words only | `ton` then does not match `Boston`. |
| Exclude posts containing | Skip posts with any of these words. |
| Only posts with | Photo, video, round video, voice, audio, document, sticker, poll, link preview, location, or text only. |
| Minimum views | Skip posts with fewer views. |
| Max posts to scan per channel | With search or filters, how many posts are read at most per channel while looking for matches (default 5,000). Reading is free; only returned posts are charged. |
| Only new posts since the last run | Per-channel memory for scheduled runs. The first run returns the newest posts and remembers where it stopped; later runs return only newer posts, oldest first. If a run stops early (maximum posts, maximum cost), the next run continues exactly after the last post returned: nothing is skipped and nothing is returned twice. Use *Memory name* to keep separate memories for different tasks. |
| Only posts after these post ids | Your own per-channel cursor, for example `{"durov": 540}`: posts with a higher id, oldest first. |
| Find channels by keyword | Topics to look up on Google (`site:t.me`); each channel found is read with the settings below. |
| Google pages per keyword | 1 to 5, about 10 results each. |
| Also read related channels | Up to this many channels found through your channels' posts, read with the same settings; rows have `discovered: true`. |
| Save media files | Copies photos, videos, voice messages and stickers to storage: `stored_url`, `file_size`, `mime_type`. $0.003 per file saved. |
| Max file size (MB) | Up to 50. Larger files are not saved; the media item says so. |
| Include comments | Adds each post's comments (for channels with comments turned on). No extra charge. |
| Max comments per post | Up to 1,000 per post. 0 adds only `comments_count`, which is fast. |
| Minimum comments | Only posts with at least this many comments. |
| Include raw HTML | Adds `raw_html`: the post's HTML as Telegram's page shows it. |
| Include service messages | Also returns notices such as "Channel photo updated", with `service: true`. |

Example:

```json
{
  "channels": ["durov", "https://t.me/telegram"],
  "maxPostsPerChannel": 200,
  "dateFrom": "30 days",
  "searchTerms": ["privacy"],
  "onlyNewPosts": false
}
```

### Output

One row per post. An album of several photos is one post with several media items.

```json
{
  "url": "https://t.me/durov/548",
  "channel": "durov",
  "post_id": 548,
  "date": "2026-09-11T16:04:02+00:00",
  "text": "🤝 Telegram has become the sponsor of Codeforces — the largest competitive programming platform in th ...",
  "views": 4620000,
  "reactions_total": 80600,
  "media_types": [],
  "channel_id": 1006503122,
  "edited": false,
  "author": "Pavel Durov",
  "author_url": null,
  "text_html": "🤝 Telegram has become the sponsor of <a href=\"https://codeforces.com/blog/entry/156620\">Codeforces</ ...",
  "text_markdown": "🤝 Telegram has become the sponsor of [Codeforces](https://codeforces.com/blog/entry/156620) — the la ...",
  "views_text": "4.62M",
  "forwarded_from": null,
  "reply_to": null,
  "via_bot": null,
  "media": [],
  "media_count": 0,
  "has_media": false,
  "album": false,
  "unsupported_media": false,
  "link_preview": {
    "url": "https://codeforces.com/blog/entry/156620",
    "site_name": "Codeforces",
    "title": "Telegram Returns as Title Sponsor of Codeforces!",
    "description": "Hi, Codeforces!",
    "image_url": "https://cdn4.telesco.pe/file/...jpg",
    "video_url": null
  },
  "poll": null,
  "buttons": [],
  "reactions": [
    {
      "emoji": "⭐",
      "custom_emoji_id": null,
      "paid": true,
      "count": 21900
    },
    {
      "emoji": null,
      "custom_emoji_id": "5399847211989246390",
      "paid": false,
      "count": 37400
    }
  ],
  "hashtags": [],
  "mentions": [],
  "links": [
    "https://codeforces.com/blog/entry/156620"
  ],
  "emails": [],
  "service": false,
  "channel_url": "https://t.me/durov",
  "channel_title": "Pavel Durov",
  "channel_subscribers": 10041572,
  "channel_verified": true,
  "channel_description": "Founder of Telegram.",
  "channel_avatar_url": "https://cdn4.telesco.pe/file/...jpg",
  "channel_counts": {
    "photos": 104,
    "videos": 47,
    "links": 202
  },
  "channel_last_post_at": "2026-11-10T20:43:28+00:00",
  "scraped_at": "2026-11-11T11:12:19+00:00",
  "error": null
}
```

Every row also has `media_count`, `has_media`, `service`, `channel_url` and `channel_last_post_at` (the date of the channel's newest post).

Media items carry `type` (photo, video, round_video, voice, audio, document, sticker, animated_sticker, video_sticker, location, contact, game, invoice), `url`, `thumbnail_url`, `duration` in seconds, `post_id`, and `title` and `details` for files, songs, locations and contacts. Polls carry the question, type, voter count and each option's share. Search runs add `matched_terms` and `match_source` (`telegram_search` when Telegram's own search found the post, `history_scan` when the Actor found it reading older posts). With comments on, each post gets `comments_count`, `comments_status` (`ok`, or why there are none) and `comments` (author, date, text, reply).

Every row has `status` (`ok` or `error`); error rows also have a short `error_code` (`not_found`, `access_restricted`, `invalid_input`, `missing_input`, `no_data`, `partial_result`, `cost_limit`, `network_error`, `proxy_missing`, `internal_error`) and an `error` that says what happened, for example:

- `Channel not found: no public channel uses the username @x. Check the spelling.`
- `@x is a channel whose web preview is turned off (by its owner or by Telegram), so its posts cannot be read without a Telegram account.`
- `@x is a bot, not a channel.`
- `No posts matched the filters (5000 posts read, stopped because the scan limit of 5000 posts read was reached).`

Error rows are always free.

| `error_code` | Meaning | Retry helps? |
|---|---|---|
| `not_found` | No public channel with that username, or no such post | No: check the spelling |
| `access_restricted` | The channel's web preview is off, so posts need a Telegram account | No |
| `invalid_input` | Not a channel username or link (a bot, group or person, or a bad date) | No: fix the input |
| `missing_input` | No channel, post link or keyword given | No: add one |
| `no_data` | The channel was read but no post matched the filters | No: widen the filters |
| `partial_result` | Some posts of a channel could not be read | Yes |
| `cost_limit` | Your maximum cost per run was reached | Yes, with a higher limit |
| `network_error` | Telegram did not answer after retries | Yes, later |
| `proxy_missing` | Keyword discovery needs Apify Proxy, which is not available to the run | No |
| `internal_error` | A bug on our side | Yes; report it if it repeats |

Each run also saves a summary in its key-value store under `OUTPUT`: posts per channel, posts and pages read, why each channel stopped, requests, retries, the slowest request, megabytes downloaded, and `related_channels`: the channels the returned posts forward from, link to or mention, most-referenced first.

### Good to know

- Only public channels with the web preview on can be read: the same posts anyone sees at `t.me/s/<channel>`. Private channels, groups and channels whose owner turned the preview off cannot.
- Views and reactions are rounded the way Telegram shows them (4.58M). Subscriber counts are exact.
- Photo and video links point to Telegram's servers and expire after a while; download what you need to keep.
- Some content (large videos, stories, paid media) is not shown on the web: those posts have `unsupported_media: true` and a link to open them in Telegram.
- Telegram's search inside a channel shows only its newest 22 matches. *Deep* search reads older posts and matches your terms itself, so older matches are found too; matching is by letters (case does not matter), not by Telegram's word forms.

### FAQ

**Is it legal?** The Actor reads only what anyone can open without an account at `t.me/s/<channel>`: posts that channel owners chose to make public. Scraping public data is generally allowed, but check the laws and terms that apply to you and what you do with the data.

**Does it collect personal data?** Posts and comments can hold names, usernames and anything people wrote. Collect only what you need, and if you store or process data about people in the EU, GDPR applies to you.

**Do I need a Telegram account or API key?** No.

### Your responsibility

You decide what you collect and how you use it. Respect Telegram's terms, the channels' rights in their content, and the privacy laws that apply to you, such as GDPR for comments by people in the EU.

# Changelog

This Actor's version history is a separate document: https://apify.com/data-for-agents/telegram-channel-posts/changelog.md

# Actor input Schema

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

Public Telegram channels, one per line: a username (durov), @durov, or a link (https://t.me/durov, t.me/s/durov).

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

Links to single posts, like https://t.me/durov/548: each post is returned as it is now (views, reactions, comments). Optional; use it with or without channels.

## `discoverKeywords` (type: `array`):

Topics to find channels for on Google (site:t.me), for example 'crypto news'. Each channel found is read with the settings below; rows have discovered: true and discovered_by. Charged per Google results page read.

## `googlePagesPerKeyword` (type: `integer`):

About 10 results per page.

## `maxRelatedChannels` (type: `integer`):

Find up to this many more channels that your channels' posts forward from, link to or mention, and read them with the same settings (search terms, dates, filters). Rows from them have discovered: true. 0 means off.

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

How many posts to return from each channel, newest first. With search terms or filters, how many matching posts.

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

Oldest post date to include: 2026-01-31, 2026-01-31T08:00:00Z, or relative like 7 days, 24 hours, 3 months. Optional.

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

Newest post date to include, same formats. A bare date includes that whole day. Optional; empty means now.

## `searchTerms` (type: `array`):

Return only posts that contain these words, searched inside every channel above. Two words need both words; put a phrase in quotes for the exact phrase. Optional.

## `searchDepth` (type: `string`):

Fast: Telegram's own search, which stops at about the 22 newest matches per term. Deep: Telegram's search, then the channel's older posts are read and matched too, up to 'Max posts to scan'.

## `wholeWords` (type: `boolean`):

Match search and exclude terms as whole words: 'ton' then does not match 'Boston'.

## `excludeTerms` (type: `array`):

Skip posts that contain any of these words. Optional.

## `mediaTypes` (type: `array`):

Return only posts that have at least one of these. Empty means all posts.

## `minViews` (type: `integer`):

Return only posts with at least this many views. 0 means no minimum.

## `minComments` (type: `integer`):

Return only posts with at least this many comments. Reads one small comments page per candidate post. 0 means no minimum.

## `maxPostsToScan` (type: `integer`):

With search terms or filters, how many posts of a channel are read at most while looking for matches. Posts that do not match are free.

## `onlyNewPosts` (type: `boolean`):

For scheduled runs. The first run returns the newest posts; later runs return only newer posts, oldest first, and continue exactly where the last run stopped. The memory is kept in your account's key-value store 'telegram-channel-posts-memory'.

## `memoryKey` (type: `string`):

Separate memories for different schedules or tasks that read the same channels. Optional.

## `afterPostIds` (type: `object`):

Your own cursor per channel, for example {"durov": 540}: only posts with a higher id are returned, oldest first. Optional.

## `includeComments` (type: `boolean`):

Add each post's comments (channels with comments turned on). One extra page per post, so the run is slower. No extra charge.

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

How many comments to add to each post, oldest first. 0 adds only the comment count.

## `includeServiceMessages` (type: `boolean`):

Also return the channel's service messages, such as 'Channel photo updated' or a pinned message notice. They have service: true and are charged like posts.

## `includeRawHtml` (type: `boolean`):

Add each post's HTML as Telegram's page shows it (raw_html), for your own parsing.

## `downloadMedia` (type: `boolean`):

Copy each photo, video, voice message and sticker to this run's key-value store and add a lasting link (stored_url), the file size and type. Telegram's own links expire. Charged per file saved.

## `maxMediaSizeMB` (type: `integer`):

Files larger than this are not saved; the row says so.

## `proxyConfiguration` (type: `object`):

Not needed today: Telegram answers Apify's servers directly. Turn on only if a run reports that Telegram stopped answering.

## `healthCheck` (type: `boolean`):

For the maintainer's weekly check: the run fails if Telegram's pages show markup this Actor does not know, or a channel returns no posts.

## Actor input object example

```json
{
  "channels": [
    "durov",
    "telegram"
  ],
  "googlePagesPerKeyword": 1,
  "maxRelatedChannels": 0,
  "maxPostsPerChannel": 100,
  "searchDepth": "deep",
  "wholeWords": false,
  "minViews": 0,
  "minComments": 0,
  "maxPostsToScan": 5000,
  "onlyNewPosts": false,
  "memoryKey": "default",
  "includeComments": false,
  "maxCommentsPerPost": 50,
  "includeServiceMessages": false,
  "includeRawHtml": false,
  "downloadMedia": false,
  "maxMediaSizeMB": 50,
  "proxyConfiguration": {
    "useApifyProxy": false
  },
  "healthCheck": false
}
```

# Actor output Schema

## `posts` (type: `string`):

Every row: posts (status ok) and free error rows (status error).

## `summary` (type: `string`):

Posts per channel, why each channel stopped, requests, retries and related_channels.

# 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 = {
    "channels": [
        "durov",
        "telegram"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("data-for-agents/telegram-channel-posts").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 = { "channels": [
        "durov",
        "telegram",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("data-for-agents/telegram-channel-posts").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 '{
  "channels": [
    "durov",
    "telegram"
  ]
}' |
apify call data-for-agents/telegram-channel-posts --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,data-for-agents/telegram-channel-posts"
        }
    }
}
```

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/ZKXj9fVNPcth5xUaM/builds/gzfE3bLCNzeqYc7Mn/openapi.json
