# Telegram Scraper — Channels, Messages & Search (`alias_md5/telegram-scraper`) Actor

Monitor public Telegram channels for crypto, news, market signals, and brand mentions — bulk message history, subscriber counts, views, reactions, media links, and keyword search exported to clean JSON, CSV, or Excel ($0 on failed or private channels).

- **URL**: https://apify.com/alias_md5/telegram-scraper.md
- **Developed by:** [Alias Data Studio](https://apify.com/alias_md5) (community)
- **Categories:** Social media, News, AI
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.60 / 1,000 telegram message records

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/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

Fast, structured data extraction for public Telegram channels. Collect historical messages, channel metadata, subscriber statistics, emoji and Stars reactions, media URLs, links, hashtags, replies, forwards, and keyword search results in clean JSON, CSV, or Excel.

### What You Can Extract

- **Channel Messages (`channel_messages`)**: Collect historical posts from one or many public Telegram channels (newest first) with full backward pagination, optional UTC date cutoff (`sinceDate`), and optional keyword filters.
- **Channel Info & Statistics (`channel_info`)**: Pull channel title, canonical `@username`, clean plain-text description, subscriber count, media counters (photos, videos, files, links), avatar URL, and verification badge.
- **Keyword Search in Channels (`search_in_channels`)**: Search across one or more public channels for specific terms or topics with multi-page history pagination and strict deduplication.

### Flexible Input Normalization

Provide raw handles (`telegram`, `@durov`), full channel links (`https://t.me/toncoin`, `https://t.me/s/telegram`), legacy domains (`telegram.me`, `telegram.dog`), or individual post URLs—all targets are normalized automatically.

Private invite links, nonexistent handles, bots, personal accounts, and channels with public preview disabled are skipped cleanly and recorded in `RUN_SUMMARY` at zero charge.

### Input Examples

#### 1. Collect Recent Messages from Public Channels

```json
{
  "mode": "channel_messages",
  "channels": ["telegram", "@durov", "https://t.me/toncoin"],
  "maxMessagesPerChannel": 100
}
```

#### 2. Search Multiple Channels for Keywords

```json
{
  "mode": "search_in_channels",
  "channels": ["telegram", "durov", "toncoin"],
  "queries": ["Stars", "TON"],
  "maxMessagesPerChannel": 50
}
```

#### 3. Extract Channel Metadata Only

```json
{
  "mode": "channel_info",
  "channels": ["telegram", "durov", "toncoin"]
}
```

#### 4. Incremental Monitoring Since a Specific UTC Date

```json
{
  "mode": "channel_messages",
  "channels": ["telegram", "durov"],
  "sinceDate": "2026-01-01",
  "maxMessagesPerChannel": 200,
  "includeChannelInfo": true
}
```

### Output Schema

Every dataset record includes a `recordType` discriminator (`message` or `channel_info`) so flat CSV/Excel exports and JSON streams stay clean and consistent.

#### Message Record (`recordType: "message"`)

```json
{
  "recordType": "message",
  "messageId": 558,
  "channelUsername": "durov",
  "channelTitle": "Pavel Durov",
  "author": "Pavel Durov",
  "dateIso": "2026-11-18T14:22:10.000Z",
  "text": "Clean plain-text message body with zero raw markup.",
  "views": 2120000,
  "forwards": null,
  "repliesCount": null,
  "reactions": [
    { "emoji": "⭐", "count": 17000, "isPaid": true },
    { "emoji": "❤", "count": 725, "isPaid": false }
  ],
  "mediaUrls": [
    "https://cdn4.telesco.pe/file/example.jpg"
  ],
  "links": [
    "https://fragment.com/username/example"
  ],
  "hashtags": ["#TON"],
  "replyToMessageId": 557,
  "forwardedFrom": null,
  "isServiceMessage": false,
  "messageUrl": "https://t.me/durov/558",
  "sourceMode": "channel_messages"
}
```

#### Channel Info Record (`recordType: "channel_info"`)

```json
{
  "recordType": "channel_info",
  "username": "telegram",
  "title": "Telegram News",
  "description": "The official Telegram on Telegram. Much recursion. Very Telegram. Wow.",
  "subscribersCount": 9050000,
  "photosCount": 16,
  "videosCount": 228,
  "filesCount": null,
  "linksCount": 378,
  "photoUrl": "https://cdn1.telesco.pe/file/example.jpg",
  "isVerified": true,
  "channelUrl": "https://t.me/telegram"
}
```

### Pricing

Transparent pay-per-event pricing based solely on delivered records. Skipped, invalid, private, or nonexistent targets are never billed, and runs honor your maximum total charge limit automatically.

| Event | Included Records | Free | Bronze | Silver | Gold | Platinum | Diamond |
| --- | --- | --- | --- | --- | --- | --- | --- |
| `telegram-message` | Public channel messages & search matches | $1.00 / 1k | $0.85 / 1k | $0.70 / 1k | $0.60 / 1k | $0.50 / 1k | $0.45 / 1k |
| `telegram-channel` | Public channel metadata & statistics records | $1.50 / 1k | $1.30 / 1k | $1.10 / 1k | $0.95 / 1k | $0.80 / 1k | $0.70 / 1k |

### Integrations (MCP, n8n & API)

#### Model Context Protocol (MCP)

Connect this Actor directly to Claude Desktop, Cursor, Windsurf, or custom AI agents via the Apify MCP Server (`https://mcp.apify.com`) or stdio MCP tools:

- `telegram_channel_messages` — collect paginated historical channel messages with date cutoff and keyword filters.
- `telegram_channel_info` — fetch channel subscriber counts, descriptions, media counters, avatars, and verification status.
- `telegram_search_in_channels` — search across one or more public channels for specific terms with deduplication.

#### n8n & Workflow Automation

1. Add the official **Apify** node in **n8n** and select **Run Actor** (or **Run Actor and get dataset items**).
2. Choose **Telegram Scraper** and pass your input payload (for example, `mode: "channel_messages"`, `channels: ["telegram", "@durov"]`, `maxMessagesPerChannel: 100`).
3. Send structured records directly into Slack, Discord, Google Sheets, Notion, Postgres, or an AI digest workflow on a recurring schedule.

You can also trigger runs programmatically over HTTPS via the Apify REST API or official JavaScript and Python clients.

### Run Summary

Every run writes a structured `RUN_SUMMARY` record to the default key-value store containing delivery totals, duration, and skipped targets with their reasons.

# Actor input Schema

## `mode` (type: `string`):

Choose whether to extract channel messages, channel metadata, or search messages by keyword across channels.

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

Public Telegram channel usernames, @handles, or t.me URLs (for example: telegram, @durov, https://t.me/toncoin).

## `startUrls` (type: `array`):

Optional list of Telegram channel URLs (t.me/username, t.me/s/username, or t.me/s/username?q=keyword). Normalized automatically.

## `queries` (type: `array`):

Keywords or phrases to search across the selected channels in search_in_channels mode, or to filter messages in channel_messages mode.

## `maxMessagesPerChannel` (type: `integer`):

Maximum number of messages to collect per channel (newest first with backward pagination).

## `sinceDate` (type: `string`):

Optional UTC date cutoff (YYYY-MM-DD or ISO-8601 timestamp). Stops collecting once older messages are reached.

## `includeChannelInfo` (type: `boolean`):

When collecting messages or searching channels, also include a structured channel_info metadata record for each channel.

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

Include channel system notifications such as title or photo change events alongside regular posts.

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

Network routing settings for reliable large-scale collection.

## Actor input object example

```json
{
  "mode": "channel_messages",
  "channels": [
    "telegram"
  ],
  "queries": [
    "Stars"
  ],
  "maxMessagesPerChannel": 30,
  "includeChannelInfo": false,
  "includeServiceMessages": false,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

## `runSummary` (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 = {
    "channels": [
        "telegram"
    ],
    "queries": [
        "Stars"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("alias_md5/telegram-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 = {
    "channels": ["telegram"],
    "queries": ["Stars"],
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("alias_md5/telegram-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 '{
  "channels": [
    "telegram"
  ],
  "queries": [
    "Stars"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call alias_md5/telegram-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,alias_md5/telegram-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/3bHCQo6C99ZwE3r71/builds/Su6QNztO4r4Y50P7n/openapi.json
