# Telegram Channel Scraper — Messages, Views, Media & OSINT (`zhorex/telegram-channel-scraper`) Actor

Scrape public Telegram channels with no API key: messages, view counts, reactions, media URLs and channel analytics. Messaging data for OSINT, crypto signal tracking and brand monitoring. An optional Telethon mode adds groups and member lists with your own credentials.

- **URL**: https://apify.com/zhorex/telegram-channel-scraper.md
- **Developed by:** [Sami](https://apify.com/zhorex) (community)
- **Categories:** Social media, Lead generation, News
- **Stats:** 47 total users, 6 monthly users, 99.7% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5,000.00 / 1,000 1,000 messages extracteds

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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Telegram Channel & Group Scraper

Extract messages, reactions, media metadata, and member data from any public Telegram channel or group. **No login required** for basic scraping. The most reliable Telegram scraper on Apify — zero crashes, zero empty results.

### What is Telegram Channel & Group Scraper?

This Apify Actor scrapes public Telegram channels and groups, extracting messages with full metadata including view counts, reactions (emoji + counts), media URLs, forwarded message info, hashtags, mentions, and channel statistics.

It supports **two scraping modes**:

- **Web Preview** (default): Zero-friction, no credentials needed. Uses Telegram's public `t.me/s/` endpoint.
- **Telethon API**: Full access with your Telegram API credentials — complete message history (10,000+), member lists, and more.

### Telegram API alternative — no login required

Looking for a Telegram scraper that works without API credentials? This Actor's default mode (Web Preview) requires zero setup — no API key, no phone number, no login. Just paste channel URLs and get structured data.

For power users who need full message history (10,000+) and member lists, the Telethon API mode provides complete access with your own Telegram API credentials.

### Why This Actor vs. Others?

| Feature | This Actor | tri\_angle (1.4 stars) | pamnard (1.3 stars) | agentx (5.0 stars) |
|---------|-----------|----------------------|---------------------|-------------------|
| No login needed | Yes | No | No | No |
| Reactions data | Yes | No | No | Yes |
| Media metadata | Yes | Partial | No | Yes |
| Error handling | Never crashes | Frequent crashes | Empty results | Good |
| Messages limit | 10,000+ | ~100 | ~100 | 500 |
| Member extraction | Yes (optional) | No | No | No |
| Date filtering | Yes | No | No | No |
| Multi-channel | Yes | Limited | Limited | Yes |

### Quick Start

#### Step 1: Paste channel URLs

```json
{
    "channels": [
        "https://t.me/durov",
        "t.me/techcrunch",
        "coindesk"
    ]
}
```

#### Step 2: Click Run

The actor accepts full URLs, short URLs, or just the channel username. All formats work.

#### Step 3: Download Results

Export to JSON, CSV, Excel, or connect via API. Each message is an individual row for easy analysis.

### ⏰ Turn it into a monitor: only NEW messages, only pay for new (delta mode)

Most of this Actor's value is in **watching** channels, not pulling them once. Turn on **`deltaMode`** and every run returns — and bills — **only messages posted since the previous run** of that stream:

```json
{
    "channels": ["durov", "coindesk"],
    "maxMessagesPerChannel": 1000,
    "deltaMode": true,
    "deltaStateKey": "crypto-alpha"
}
```

**How it behaves**

1. **First run** returns the current history and sets the baseline (per channel).
2. **Every run after that** returns only genuinely new messages — already-seen ones are skipped, not returned, **not charged**.
3. **A quiet channel costs nothing**: if nothing new was posted, nothing is pushed and no scrape event is billed.

Then attach a schedule — **Apify Console → Schedules → Create**, pick this Actor and your saved input, and set a cron (`0 * * * *` hourly, `0 8 * * *` daily at 8am). You now have a hands-off "what's new in these channels" feed that grows a timestamped archive you own.

> 💡 **`deltaStateKey`** names an independent stream, so several monitors never collide — e.g. `crypto-alpha` for signal channels and `tipsters` for betting channels, each tracked separately even if they share channels. Delta works in **both** modes (web preview and Telethon API); member lists are snapshots and are not delta-filtered.

**Why this matters for cost:** because view counts and message ids are stable, delta mode is exact — you are not re-paying for the same 100 messages every hour just to discover the 3 that are new.

### Use Cases

- **OSINT & Intelligence**: Monitor public channels for threat intelligence, track disinformation, and analyze information operations.
- **Marketing & Competitive Analysis**: Analyze competitor community engagement, content strategy, and audience reactions.
- **Crypto & Web3 Research**: Track token launches, monitor signal channels, and measure community sentiment across crypto groups.
- **Compliance & Archival**: Archive channel history for regulatory requirements, legal discovery, or organizational record-keeping.
- **Academic Research**: Collect data for studies on online communities, information spread, and public discourse patterns.
- **Lead Generation**: Extract member data from public groups (Telethon mode, GDPR-compliant use only).

### Two Scraping Modes

#### Mode 1: Web Preview (Default — No Login)

Uses Telegram's public web preview at `t.me/s/`. Perfect for quick data collection without any setup.

- **No credentials needed** — works out of the box
- **Public channels only** — channels must have web preview enabled
- **Full channel history** — the public preview paginates all the way back, 20 messages per page, no API key
- **Extracts**: text, HTML, views, reactions, media URLs, forwards, replies, links, hashtags, mentions

#### Mode 2: Telethon API (Full Access)

Uses Telegram's official API via the Telethon library. Unlocks complete channel data.

- **Requires API credentials** — api\_id + api\_hash from [my.telegram.org](https://my.telegram.org/apps)
- **Full message history** — up to 10,000+ messages per channel
- **Member extraction** — optional, requires appropriate permissions
- **Bot token support** — use a Bot Token from @BotFather as an alternative

##### How to Get API Credentials

1. Go to [my.telegram.org](https://my.telegram.org/apps)
2. Log in with your phone number
3. Create a new application (or use an existing one)
4. Copy the **API ID** (number) and **API Hash** (string)

##### How to Generate a Session String

Run this Python script locally (one time only):

```python
from telethon.sync import TelegramClient
from telethon.sessions import StringSession

api_id = 12345        # Your API ID
api_hash = "abc123"   # Your API Hash

with TelegramClient(StringSession(), api_id, api_hash) as client:
    print("Your session string:")
    print(client.session.save())
```

This will prompt you for your phone number and a verification code. Copy the output string and paste it into the actor's `sessionString` input field.

##### Using a Bot Token Instead

If you only need to read public channel messages (no member lists), you can use a Bot Token:

1. Message [@BotFather](https://t.me/BotFather) on Telegram
2. Create a new bot with `/newbot`
3. Copy the token and paste it into the `botToken` input field
4. Add your bot to the channel as an admin (or the channel must be public)

### Input Parameters

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `channels` | array | Yes | — | Telegram channel URLs or usernames |
| `mode` | string | No | `web_preview` | `web_preview` or `telethon_api` |
| `maxMessagesPerChannel` | integer | No | 1000 | Max messages per channel (up to 10,000). Billing is per started 1,000-message block, so asking for fewer than 1,000 costs the same and returns less. |
| `deltaMode` | boolean | No | `false` | **Recurring monitor:** return & bill ONLY messages posted since the previous run of this stream. First run sets the baseline; a quiet channel costs nothing. Works in both modes. |
| `deltaStateKey` | string | No | `default` | Names an independent delta stream so multiple monitors don't collide (e.g. `crypto-alpha` vs `tipsters`). Only used when `deltaMode` is on. |
| `extractMedia` | boolean | No | true | Include media metadata in output |
| `extractReactions` | boolean | No | true | Include reaction counts |
| `extractMemberData` | boolean | No | false | Extract member list (Telethon only) |
| `dateFrom` | string | No | — | Only messages after this date (ISO format) |
| `dateTo` | string | No | — | Only messages before this date (ISO format) |
| `apiId` | integer | No | — | Telegram API ID (Telethon only) |
| `apiHash` | string | No | — | Telegram API Hash (Telethon only, secret) |
| `sessionString` | string | No | — | Pre-generated session string (Telethon only, secret) |
| `botToken` | string | No | — | Bot Token from @BotFather (Telethon only, secret) |

### Input Example

#### Web Preview Mode (No Login)

```json
{
    "channels": [
        "https://t.me/durov",
        "coindesk"
    ],
    "mode": "web_preview",
    "maxMessagesPerChannel": 200,
    "extractMedia": true,
    "extractReactions": true,
    "dateFrom": "2026-01-01"
}
```

#### Telethon API Mode (Full Access)

```json
{
    "channels": ["https://t.me/durov"],
    "mode": "telethon_api",
    "maxMessagesPerChannel": 5000,
    "apiId": 12345,
    "apiHash": "your_api_hash_here",
    "sessionString": "your_session_string_here",
    "extractMemberData": false
}
```

### Output Example

Each message is stored as an individual item in the dataset:

```json
{
    "id": 350,
    "date": "2026-04-05T18:30:00+00:00",
    "text": "Today we're launching a new feature...",
    "text_html": "Today we're launching a <b>new feature</b>...",
    "views": 2100000,
    "views_display": "2.1M",
    "author": null,
    "forwarded_from_name": null,
    "forwarded_from_url": null,
    "reply_to_message_id": null,
    "media_type": "photo",
    "media_url": "https://cdn4.telesco.pe/file/...",
    "reactions": [
        { "emoji": "\ud83d\udc4d", "count": 42000 },
        { "emoji": "\u2764\ufe0f", "count": 15000 }
    ],
    "reactions_total": 57000,
    "links": ["https://telegram.org/blog/new-feature"],
    "hashtags": ["#telegram"],
    "mentions": null,
    "message_url": "https://t.me/durov/350",
    "channel_name": "Durov's Channel",
    "channel_username": "durov",
    "channel_url": "https://t.me/durov",
    "channel_subscribers": 10300000,
    "channel_verified": true,
    "scrape_mode": "web_preview",
    "scraped_at": "2026-04-12T15:00:00+00:00"
}
```

### Pricing

This actor uses **Pay Per Event** pricing.

| Event | Price |
|-------|-------|
| Actor run started | $0.00005 (per GB of memory, minimum 1 event) |
| Channel scraped (web preview) | $0.02 per channel |
| Channel scraped (Telethon API) | $0.05 per channel |
| 1,000 messages extracted | $0.50 · **$5.00 from 15 August 2026** |
| 1,000 members extracted | $1.00 |

#### Cost Examples

Shown at the **$5.00 / 1,000 messages** rate that applies from 15 August 2026. Messages are billed **per channel** in blocks of 1,000, rounded up — a channel that returns 100 messages still bills one full 1,000-message block, so scraping many small channels costs more than the raw message count suggests. **The practical consequence: leave `maxMessagesPerChannel` at 1,000 or higher.** Asking for 100 costs exactly the same $5 as asking for 1,000 — the default is set to 1,000 for that reason, and the public preview really does paginate that deep (measured: 11 years of history in one run).

| Scenario | Cost |
|----------|------|
| 5 channels, 100 messages each (web preview) | ~$25.10 |
| 1 channel, 5,000 messages (Telethon) | ~$25.06 |
| 10 channels, 200 messages each (web preview) | ~$50.20 |
| 1 channel, 1,000 messages + members (Telethon) | ~$6.06 |

With `deltaMode` on, a scheduled run that finds nothing new charges **nothing at all** — not even the per-channel event — so a daily monitor costs a fraction of the figures above.

Platform compute costs are billed separately by Apify at standard rates. This actor runs on minimal resources (256MB RAM).

### How to Scrape Telegram Channels

Scraping Telegram channels for data analysis, research, or monitoring is straightforward with this actor:

1. **Find the channel**: Navigate to the Telegram channel in your browser or app. The URL format is `t.me/channelname`.
2. **Configure the actor**: Paste the channel URL(s) into the input. Choose your scraping mode and set the message limit.
3. **Run the actor**: Click "Start" on Apify. The actor handles pagination, rate limiting, and error recovery automatically.
4. **Export your data**: Download results as JSON, CSV, or Excel. Or connect via API for automated pipelines.

The actor automatically handles:

- Rate limiting with exponential backoff
- Pagination to collect all available messages
- Private/non-existent channel detection
- Multiple input formats (URLs, usernames, with/without @)

### Integration Examples

#### Python SDK

```python
from apify_client import ApifyClient

client = ApifyClient("your_api_token")

run = client.actor("zhorex/telegram-channel-scraper").call(run_input={
    "channels": ["https://t.me/durov"],
    "maxMessagesPerChannel": 100,
})

for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(f"{item['date']}: {item['text'][:80]}")
```

#### cURL

```bash
curl "https://api.apify.com/v2/acts/zhorex~telegram-channel-scraper/runs" \
  -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -d '{"channels": ["durov"], "maxMessagesPerChannel": 50}'
```

#### Webhook / n8n Integration

Set up an Apify webhook to trigger when the actor finishes, then process results in n8n, Zapier, or any automation tool.

### FAQ

#### Does this require a Telegram API key?

**No** (for web preview mode). The default mode uses Telegram's public web preview at `t.me/s/` which requires no authentication. For Telethon mode, you need API credentials from [my.telegram.org](https://my.telegram.org/apps).

#### Can I scrape private channels?

Only with **Telethon mode** if you are a member of the channel. Web preview mode only works with public channels that have web preview enabled.

#### What about rate limits?

The actor handles rate limits automatically. Web preview mode uses a 2-second delay between requests. Telethon mode handles Telegram's `FloodWaitError` with automatic sleep and retry. You should never see rate limit errors in your results.

#### Is this GDPR compliant?

The actor extracts publicly available data. When extracting member data (Telethon mode), ensure you have a legitimate legal basis under GDPR or applicable data protection laws. **Member data extraction is disabled by default.**

#### What formats can I export?

Apify supports **JSON**, **CSV**, **Excel (XLSX)**, and **XML**. You can also access data via the Apify API, integrate with Google Sheets, or connect to 2,000+ apps via webhooks.

#### Why do I need a phone number for Telethon mode?

Telegram's API requires phone-based authentication. You generate a session string once locally, then use it in the actor. The actor never stores or transmits your phone number.

#### What's the maximum number of messages?

Web preview mode reads the FULL channel history with no API key — Telegram's `?before=` pagination gives random access anywhere in the archive (measured 2026-08-27: 22 consecutive pages, no rate limit, no login). Raise `maxMessagesPerChannel` for deep backfills; the run simply takes longer. Telethon mode, with your own credentials, adds member data, groups, and the channels that switch their public preview off entirely.

#### Is there a free Telegram scraper?

Yes. This Actor works with Apify's free plan which includes $5 of monthly usage. The web preview mode is the most cost-effective way to scrape Telegram channels — $0.02 per channel plus $0.50 per 1,000 messages, rising to $5.00 per 1,000 messages on 15 August 2026. Messages bill per channel in blocks of 1,000, rounded up.

#### How much does it cost to scrape Telegram channels?

Web preview mode: ~$0.52 per channel (100 messages). Telethon mode: ~$0.55 per channel (1,000 messages). From 15 August 2026 those become ~$5.02 and ~$5.05 — messages bill per channel in blocks of 1,000, rounded up, so a channel that returns 100 messages still bills one full block. Start with Apify's free tier — $5 included monthly.

#### Can I use this Telegram scraper in Python?

Yes. Use the [Apify Python client](https://docs.apify.com/api/client/python) (`pip install apify-client`) to call this Actor programmatically. See the Python SDK example above.

#### Is scraping Telegram legal?

This Actor accesses publicly available data through Telegram's public web preview (`t.me/s/`) and official Telegram API. No authentication is bypassed and no private data is accessed without authorization. Always consult legal counsel for your specific use case.

#### What is the best Telegram scraper in 2026?

This Actor is the most reliable Telegram scraper on Apify — zero crashes, zero empty results, and two scraping modes (web preview + Telethon API). It supports reactions, media metadata, date filtering, and multi-channel scraping.

### Other scrapers by Zhorex

**Chinese Social Intelligence Suite:**

- [RedNote Xiaohongshu Scraper](https://apify.com/zhorex/rednote-xiaohongshu-scraper) — China's #1 lifestyle platform (300M+ users)
- [Weibo Scraper](https://apify.com/zhorex/weibo-scraper) — China's Twitter (580M+ users)
- [Bilibili Scraper](https://apify.com/zhorex/bilibili-scraper) — China's YouTube (300M+ users)

**B2B Review Intelligence:**

- [G2 Reviews Scraper](https://apify.com/zhorex/g2-reviews-scraper) — B2B software reviews via public API (no proxy)
- [Capterra Reviews Scraper](https://apify.com/zhorex/capterra-reviews-scraper) — Software reviews with sub-ratings
- [Booking.com Reviews Scraper](https://apify.com/zhorex/booking-reviews-scraper) — Hotel reviews and ratings

**Streaming Analytics:**

- [Twitch Scraper](https://apify.com/zhorex/twitch-scraper) — Streamer profiles, live streams, clips
- [Kick.com Scraper](https://apify.com/zhorex/kick-scraper) — Kick streamer analytics

**Other Tools:**

- [Perplexity AI Search Scraper](https://apify.com/zhorex/perplexity-ai-scraper) — AI search results and brand monitoring
- [Domain Authority Checker](https://apify.com/zhorex/domain-authority-checker) — Bulk SEO domain analysis
- [Phone Number Validator](https://apify.com/zhorex/phone-number-validator) — Phone validation

### Legal Disclaimer

This actor accesses publicly available data through Telegram's public web preview (`t.me/s/`) and official Telegram API. No authentication is bypassed and no private data is accessed without authorization.

When extracting member data, ensure you have a legitimate legal basis under GDPR or applicable data protection laws. Member data extraction is **disabled by default** and must be explicitly enabled.

Users are responsible for ensuring their use of extracted data complies with applicable laws and Telegram's Terms of Service.

***

### Your Review Matters

Most Telegram scrapers on Apify have 1-2 star ratings due to crashes and empty results. This one is built to be different — zero crashes, zero empty results.

If this Actor worked for you, **a 30-second review helps others find a reliable alternative:**

1. Go to the [Telegram Channel Scraper page](https://apify.com/zhorex/telegram-channel-scraper)
2. Scroll down and click the star rating
3. Optionally leave a one-line comment about your use case

**Why it matters:** Early reviews have the biggest impact on Store rankings. Your review directly helps other researchers, analysts, and developers find a scraper that actually works.

Found a bug instead? [Open an issue](https://apify.com/zhorex/telegram-channel-scraper/issues) and I'll fix it within 24 hours.

# Actor input Schema

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

List of Telegram channel URLs (https://t.me/channelname) or usernames (@channelname or just channelname). Works with both channels and public groups.

## `channelUrls` (type: `array`):

Backward-compatible alias for 'channels' used by older saved tasks. Prefer the 'channels' field above. If both are set, 'channels' wins.

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

web\_preview: No login needed, extracts latest messages from public channels (default). telethon\_api: Full access with your Telegram API credentials — complete history, members, media.

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

Maximum messages to extract per channel. <b>Billing is per started block of 1,000 messages, so 100 messages and 1,000 messages cost exactly the same</b> — the default is set to 1,000 so a run delivers a full block for the price of one. There is no ~500 cap: Telegram's public web preview paginates the FULL channel history (measured: 11 years and 424 messages of @durov in a single run), with random access anywhere in the archive, no API key and no login. Raise it further for corpus building, OSINT backfills and crypto-channel history; the run just takes longer. One caveat: some channels switch the public preview off entirely and return nothing — those need Telethon mode with your own credentials.

## `deltaMode` (type: `boolean`):

Turn this on for a scheduled monitor: each run returns (and bills) ONLY messages posted since the previous run of the same stream, per channel. A quiet channel costs nothing. The FIRST run returns the current history and sets the baseline. Pair with an Apify Schedule to get a hands-off 'what's new in these channels' feed.

## `deltaStateKey` (type: `string`):

Names an independent delta stream so several monitors don't collide. Use a distinct value per watchlist, e.g. 'crypto-alpha' vs 'tipsters'. Only matters when Delta mode is on.

## `extractMedia` (type: `boolean`):

Include media URLs, types, and thumbnails in output.

## `extractReactions` (type: `boolean`):

Include reaction counts (emoji + count) for each message.

## `extractMemberData` (type: `boolean`):

Extract group/channel member list. Requires Telethon mode and appropriate permissions. Note: contains personal data — ensure GDPR compliance. <b>Billing:</b> member extraction is charged as <code>members-1k</code> at <b>$1.00 per 1,000 members</b> — 50x the $0.02 base row — so a 50,000-member group costs about $50. Leave this off unless you need the roster.

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

Only extract messages after this date (ISO format: 2026-01-01). Optional.

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

Only extract messages before this date (ISO format: 2026-12-31). Optional.

## `apiId` (type: `integer`):

Your Telegram API ID from https://my.telegram.org/apps. Required for Telethon mode.

## `apiHash` (type: `string`):

Your Telegram API Hash from https://my.telegram.org/apps. Required for Telethon mode.

## `sessionString` (type: `string`):

Pre-generated StringSession for authentication. See README for how to generate one.

## `botToken` (type: `string`):

Telegram Bot Token from @BotFather. Can read public channel messages but NOT member lists. Alternative to session string.

## Actor input object example

```json
{
  "channels": [
    "https://t.me/durov"
  ],
  "mode": "web_preview",
  "maxMessagesPerChannel": 1000,
  "deltaMode": false,
  "deltaStateKey": "default",
  "extractMedia": true,
  "extractReactions": true,
  "extractMemberData": false
}
```

# Actor output Schema

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

Dataset with all rows this run produced

# 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": [
        "https://t.me/durov"
    ],
    "maxMessagesPerChannel": 1000,
    "deltaStateKey": "default"
};

// Run the Actor and wait for it to finish
const run = await client.actor("zhorex/telegram-channel-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": ["https://t.me/durov"],
    "maxMessagesPerChannel": 1000,
    "deltaStateKey": "default",
}

# Run the Actor and wait for it to finish
run = client.actor("zhorex/telegram-channel-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": [
    "https://t.me/durov"
  ],
  "maxMessagesPerChannel": 1000,
  "deltaStateKey": "default"
}' |
apify call zhorex/telegram-channel-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,zhorex/telegram-channel-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/4YPto7aF87HZGr2iC/builds/6WH1dFaKuRGXHB70b/openapi.json
