# Telegram Channel Scraper (Public Channels, Incremental) (`rawtojson/telegram-channel-scraper`) Actor

Scrape messages, views, links, hashtags and media from public Telegram channels. No account, no API key. Incremental mode returns only new messages, perfect for scheduled monitoring, n8n, Make and AI agents (MCP).

- **URL**: https://apify.com/rawtojson/telegram-channel-scraper.md
- **Developed by:** [Juan Francisco](https://apify.com/rawtojson) (community)
- **Categories:** Social media, Lead generation, AI
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.80 / 1,000 message scrapeds

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 — public channels, incremental, no login

Scrape messages from **public Telegram channels** into clean, compact JSON. **No Telegram account, no API key, no phone number.** Built for scheduled monitoring, OSINT, market research, n8n / Make workflows and AI agents (MCP).

Get text, publication date, **view counts**, links, hashtags, media types, forwarded-from source and channel subscriber count — and in **incremental mode** only the messages published since your last run, so scheduled runs only pay for new data.

### What you can do with it

- **Monitor channels on a schedule** — run every hour and get only new posts (`onlyNewMessages`).
- **Track keywords** — return only messages that mention your brand, token or topic (`keywords`).
- **Research and OSINT** — archive a channel's history with dates and views for analysis.
- **Feed AI agents and RAG** — compact JSON with no HTML noise, ready for an LLM.
- **Find where to advertise** — compare views and subscribers across channels.

### How it works

The Actor reads Telegram's own public web preview of a channel (`t.me/s/<channel>`), the same page anyone can open in a browser. It uses plain HTTP — no browser and no proxy — so runs are fast and cheap.

### Input

| Field | Type | Description |
|---|---|---|
| `channels` | array | Usernames (`durov`), `@usernames` or links (`https://t.me/durov`). |
| `maxMessagesPerChannel` | integer | Max messages per channel, newest first. Default `100`. |
| `onlyNewMessages` | boolean | Return only messages newer than the previous run on your account. Default `false`. |
| `keywords` | array | Optional. Keep only messages containing at least one keyword (case-insensitive). |
| `dateFrom` | string | Optional. Ignore messages older than `YYYY-MM-DD`. |

Example:

```json
{
  "channels": ["durov", "https://t.me/telegram"],
  "maxMessagesPerChannel": 200,
  "onlyNewMessages": true,
  "keywords": ["update", "launch"]
}
```

### Output

One dataset item per message:

```json
{
  "channel": "durov",
  "messageId": 568,
  "date": "2026-11-21T22:48:52+00:00",
  "text": "You won't look professional in 2027 if your QR is unpimped.",
  "views": 244000,
  "url": "https://t.me/durov/568",
  "author": "Pavel Durov",
  "forwardedFrom": null,
  "edited": false,
  "mediaTypes": ["video"],
  "links": [],
  "hashtags": [],
  "channelTitle": "Pavel Durov",
  "channelSubscribers": 9910000
}
```

`mediaTypes` can contain `photo`, `video`, `document`, `voice`, `poll` and `link_preview`. Messages are returned newest first.

### Pricing

**Pay per event: you only pay for the messages you receive.** Messages filtered out by `keywords`, `dateFrom` or incremental mode are not charged. Channels that cannot be read are skipped and not charged. Set a maximum cost per run in the Apify run options and the Actor stops cleanly when it is reached.

### Use it with n8n, Make and AI agents

- **n8n / Make:** use the Apify node or module "Run Actor", then read the dataset. Schedule it hourly with `onlyNewMessages: true` to get an alert pipeline.
- **MCP / AI agents:** the input is a small flat schema, so agents can call it directly through the Apify MCP server (`mcp.apify.com`).
- **API:** run it with the Apify API or the JavaScript / Python client like any other Actor.

### Limits and good to know

- Works only for channels with a **public web preview**. Private channels, groups and channels that disable the preview are not supported and are skipped with an error item.
- Telegram's public preview does not expose comments, reactions or the full list of subscribers.
- The Actor adds a short pause between pages and retries politely on rate limits.
- Respect Telegram's terms and local law. Telegram's API terms restrict using its data to train AI models; if you plan that, check them first. Collect and process only public content, and do not use the data to harass or profile private individuals (GDPR applies to personal data).

### FAQ

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

**Can it read private channels or groups?** No — only public channels with a web preview.

**How far back can it go?** As far as the public preview goes, until it reaches the first message or your `maxMessagesPerChannel` / `dateFrom` limit.

**How do I get only new messages?** Turn on `onlyNewMessages` and schedule the Actor. The last seen message id is stored per channel in your account.

**A run returned an item with an `error` field.** That channel does not exist or has no public preview. Check it opens at `https://t.me/s/<channel>`.

### Support

Found a bug or need a field added? Open an issue on the Actor page — issues are answered within 24 hours. More Actors by rawtojson at **https://rawtojson.com**.

# Actor input Schema

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

Public Telegram channels. Accepts usernames (durov), @usernames or links (https://t.me/durov). Only channels with a public web preview (t.me/s/...) are supported.

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

Maximum number of messages to return per channel (newest first).

## `onlyNewMessages` (type: `boolean`):

Return only messages published since the last run of this Actor on your account. Ideal for schedules: you only pay for new messages.

## `keywords` (type: `array`):

Optional. Return only messages containing at least one of these words (case-insensitive). You are charged only for returned messages.

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

Optional. Stop at messages older than this date (YYYY-MM-DD).

## Actor input object example

```json
{
  "channels": [
    "durov"
  ],
  "maxMessagesPerChannel": 100,
  "onlyNewMessages": false
}
```

# Actor output Schema

## `messages` (type: `string`):

Messages from the public channels, newest first.

# 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"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("rawtojson/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": ["durov"] }

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

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,rawtojson/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/5JAef0blcjuHk0KHL/builds/AyFFq2ZqEcv8Cq0YB/openapi.json
