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

Scrape public Telegram channels: full message history, media, reactions, polls, forwards, replies, link previews, channel stats, and in-channel keyword search. HTTP-only, no login or phone number required. Independent tool, not affiliated with Telegram.

- **URL**: https://apify.com/scrapesage/telegram-scraper.md
- **Developed by:** [Scrape Sage](https://apify.com/scrapesage) (community)
- **Categories:** Social media, News, Lead generation
- **Stats:** 30 total users, 9 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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 Scraper - Channels, Messages, Media & Search

> **Disclaimer:** This Actor is an independent tool and is not affiliated with, endorsed by, or sponsored by Telegram or any of its subsidiaries. All trademarks mentioned are the property of their respective owners. "Telegram" is referenced only to describe the publicly available website this Actor collects data from.

Extract data from **public Telegram channels** at scale — full **message history**, **media**, **reactions**, **polls**, **forwards**, **replies**, **link previews**, **channel stats**, and **in-channel keyword search**. **No login, no phone number, no API keys.**

No login / no cookies — HTTP-only (no headless browser) for fast, low-cost, reliable runs.

### Why this Telegram scraper?

| Typical scrapers | This actor |
|---|---|
| Require a phone number, login, or API credentials | No login, no phone number, no API keys — reads the public web preview |
| Return plain message text only | Returns text **plus** views, author, forwards, replies, hashtags, mentions, links, media, polls and link previews |
| Headless browser, slow and expensive | HTTP-only (Cheerio) — fast, low-cost, reliable |
| No way to filter inside a channel | Native **in-channel keyword search** returns only matching messages |
| Whole-timeline only | Filter by date range (newer than / older than, ISO or relative like `7 days`) |
| Channel metadata is an afterthought | Dedicated `channelInfo` mode for title, description, subscriber and content counts |

### Use cases

- **Crypto / web3 monitoring** — track trading-signal channels and community sentiment across many channels at once.
- **OSINT & threat intelligence** — collect message history, forwards, and link previews from public channels for analysis.
- **News & topic aggregation** — pull fresh posts from news and announcement channels and filter to a recent date window.
- **Brand & competitor tracking** — search channels by keyword to surface only mentions you care about.
- **LLM / RAG dataset building** — export clean, structured message records for fine-tuning, retrieval, and sentiment pipelines.

### How to use

1. [Sign up for Apify](https://console.apify.com/sign-up) — the free plan is enough to try this actor.
2. Open the **Telegram Scraper**, fill in the inputs you need, and click **Start**.
3. Watch results stream into the dataset table as each record is parsed.
4. **Export** as JSON, CSV, Excel, XML, or RSS — or pull results programmatically via the [Apify API](https://docs.apify.com/api/v2).

### Input

```json
{
    "channels": ["@durov", "https://t.me/telegram"],
    "resultsType": "messages",
    "maxMessages": 200,
    "searchQuery": "",
    "oldestMessageDate": "30 days",
    "downloadMedia": false,
    "proxyConfiguration": { "useApifyProxy": true }
}
```

- **`channels`** *(required, array)* — public channels to scrape. Accepts `@username`, plain `username`, or a `t.me/username` URL (also `t.me/s/username`). Private/invite-only channels are not supported.
- **`resultsType`** *(string, default `messages`)* — `messages` to scrape each channel's messages, or `channelInfo` for channel metadata/stats only.
- **`maxMessages`** *(integer, default `100`)* — max messages per channel. Ignored when `resultsType` is `channelInfo`.
- **`searchQuery`** *(string, optional)* — when set, returns only messages matching this keyword in each channel, using Telegram's native in-channel search. Leave empty to scrape the full timeline.
- **`oldestMessageDate`** *(string, optional)* — stop once messages older than this date are reached. Accepts ISO dates (e.g. `2026-01-01`) or relative values like `7 days`, `3 months`.
- **`newestMessageDate`** *(string, optional)* — skip messages newer than this date. Accepts ISO or relative values like `1 day`.
- **`downloadMedia`** *(boolean, default `false`)* — download photos/videos/documents into the run's key-value store and add a reference to each record. Media URLs are always included regardless of this setting.
- **`proxyConfiguration`** *(object)* — proxy settings; Apify Proxy (datacenter) recommended for reliability at scale.

### Output

In `messages` mode, each message is one dataset record:

```json
{
    "channel": "durov",
    "messageId": 372,
    "url": "https://t.me/durov/372",
    "date": "2026-05-21T14:02:11+00:00",
    "text": "Example post text...",
    "views": 1200000,
    "author": "Pavel Durov",
    "forwardedFrom": null,
    "forwardedFromUrl": null,
    "replyToUrl": null,
    "isPinned": false,
    "hashtags": ["#telegram"],
    "mentions": ["@telegram"],
    "links": ["https://example.com/"],
    "media": [{ "type": "photo", "url": "https://cdn5.telesco.pe/file/..." }],
    "poll": null,
    "linkPreview": null
}
```

In `channelInfo` mode, each record contains `channel`, `url`, `title`, `username`, `description`, `avatarUrl`, `subscribers`, and content counts (`photosCount`, `videosCount`, `filesCount`, `linksCount`).

Notes:

- Optional fields are returned as `null` when Telegram doesn't expose them on the public preview (e.g. `author`, `views`, `forwardedFrom`, `poll`, `linkPreview`).
- When `downloadMedia` is enabled and a file is stored, each `media` item gains a `storeKey` pointing to the run's key-value store; media URLs are always present either way.
- Private/invite-only channels are skipped with a clear log message; the run still completes as a success.

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

This Actor uses Apify's **pay-per-event** pricing: you are charged only for the results it delivers, with no monthly rental and no start fee. The events it can charge are:

- **Message scraped** - Charged per Telegram message returned to the dataset (messages mode), including text, media, URLs, reactions, polls, forwards, replies, and link previews.
- **Channel info scraped** - Charged per channel when running in Channel info mode — title, description, avatar, subscriber count, and content stats.
- **Media downloaded** - Charged per media file (photo/video/voice/document) downloaded to the key-value store. Only fires when "Download media files" is enabled.

The current price of each event is shown on the **Pricing** tab of this page. Set a maximum total charge on the run if you want a hard cap on spend, and use the input limits to control how much the Actor fetches.

### Automate & schedule

Run this actor on autopilot and pull results into your own stack:

- **[Apify API](https://docs.apify.com/api/v2)** — start runs, fetch datasets, and manage schedules over REST.
- **[apify-client for JavaScript](https://docs.apify.com/api/client/js/)** and **[apify-client for Python](https://docs.apify.com/api/client/python/)** — official SDKs.
- **[Schedules](https://docs.apify.com/platform/schedules)** — run it on a cron to keep your data fresh.
- **[Webhooks](https://docs.apify.com/platform/integrations/webhooks)** — trigger downstream actions the moment a run finishes.

```js
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'MY_APIFY_TOKEN' });

const run = await client.actor('scrapesage/telegram-scraper').call({
    channels: ['@durov', 'https://t.me/telegram'],
    resultsType: 'messages',
    maxMessages: 200,
    oldestMessageDate: '30 days',
    downloadMedia: false,
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(`Got ${items.length} records`);
```

### Integrate with any app

Connect the dataset to 5,000+ apps — no code required:

- **[Make](https://docs.apify.com/platform/integrations/make)** — multi-step automation scenarios.
- **[Zapier](https://docs.apify.com/platform/integrations/zapier)** — push new records straight into your CRM or sheet.
- **[Slack](https://docs.apify.com/platform/integrations/slack)** — get notified when a run finds something new.
- **[Google Drive / Sheets](https://docs.apify.com/platform/integrations/drive)** — auto-export every run to a spreadsheet.
- **[Airbyte](https://docs.apify.com/platform/integrations/airbyte)** — pipe results into your data warehouse.
- **[GitHub](https://docs.apify.com/platform/integrations/github)** — trigger runs from commits or releases.

### Use with AI assistants (MCP)

The output is clean, LLM-ready JSON. Call this actor from Claude, ChatGPT, or any agent framework through the **[Apify MCP server](https://docs.apify.com/platform/integrations/mcp)** — ask your assistant to "pull the last 200 messages from @durov and summarize what changed this week" and let it run this scraper for you.

### Agent-ready: autonomous payments (x402 & Skyfire)

This actor is **agent-ready** — AI agents can discover it, run it, and **pay for it autonomously**, with no Apify account and no human in the loop. It uses [pay-per-event](https://docs.apify.com/platform/actors/publishing/monetize/pay-per-event) pricing and [limited permissions](https://docs.apify.com/platform/actors/development/permissions), so it qualifies for Apify's agentic-payment standards:

- **[x402](https://docs.apify.com/platform/integrations/x402)** — an open, HTTP-native payment protocol. Agents pay per run in USDC on the Base network directly through the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp) — no account, no API key.
- **[Skyfire](https://docs.apify.com/platform/integrations/skyfire)** — agent-to-service payments for fully autonomous AI-agent workflows.

Building an AI agent, MCP tool, or autonomous data pipeline? This scraper is ready to plug in and pay as it goes.

### More scrapers from scrapesage

Need data from other sources? Try these scrapesage actors:

- [facebook-ad-library-scraper](https://apify.com/scrapesage/facebook-ad-library-scraper) — Meta/Instagram competitor ad intelligence.
- [google-ads-transparency-scraper](https://apify.com/scrapesage/google-ads-transparency-scraper) — see who's advertising what on Google.
- [bark-scraper](https://apify.com/scrapesage/bark-scraper) — Bark.com provider profiles & leads.
- [sam-gov-scraper](https://apify.com/scrapesage/sam-gov-scraper) — US federal contract opportunities & contacts.
- [eventbrite-scraper](https://apify.com/scrapesage/eventbrite-scraper) — events plus organizer leads with contacts.
- [airbnb-scraper](https://apify.com/scrapesage/airbnb-scraper) — short-stay listings, prices, availability & market monitor.
- [linkedin-jobs-scraper](https://apify.com/scrapesage/linkedin-jobs-scraper) — filter-based LinkedIn job postings, no login.

### Tips

- Pass channels as `@username`, plain `username`, or full `t.me/...` links — the actor normalizes all three.
- Combine `searchQuery` with your channel list to pull only on-topic messages instead of the whole timeline (note: it searches within the channels you provide, not all of Telegram).
- Use `oldestMessageDate` / `newestMessageDate` with relative values like `7 days` to keep recurring runs lightweight.
- Only enable `downloadMedia` when you need the actual files — URLs are always included, and skipping the download keeps runs faster and cheaper.
- Keep `proxyConfiguration` on Apify Proxy (datacenter) for reliable runs at scale.

### FAQ

**Do I need a Telegram account, phone number, or API key?**
No. The actor reads Telegram's public web preview over HTTP — no login, no phone number, no credentials.

**Can it scrape private or invite-only channels?**
No. Only public channels are accessible via the public web preview. Private/invite-only channels (and standard user-account messages) are skipped with a clear log message.

**Is this legal?**
The actor only collects publicly visible data from public channels. You are responsible for using the data in line with Telegram's terms and applicable laws.

**What if a channel has no matching messages?**
Empty results are reported as a successful run. Date filters and `searchQuery` may legitimately return zero records for a given channel.

**In what formats can I export the data?**
JSON, CSV, Excel, XML, or RSS via the Apify console, or programmatically through the [Apify API](https://docs.apify.com/api/v2).

**Where do downloaded media files go?**
Into the run's default key-value store (when `downloadMedia` is enabled), with a `storeKey` reference added to each media item in the dataset.

### Data & lawful use

This Actor reads only what Telegram publishes to logged-out visitors: it does not log in, use cookies or session tokens, create accounts, or reach anything behind a sign-in. Names, handles, bios and engagement figures are public, but they relate to identifiable people, so treat the output as personal data. If you are in the EU or UK you are the data controller for what you do with it: have a lawful basis (usually legitimate interest for research, marketing analytics or B2B prospecting), honour access and deletion requests, and do not use the output for spam or unsolicited messaging.

Under [Apify's Standard Actor Contract](https://docs.apify.com/legal/standard-actor-contract), which governs your use of this Actor, you are the controller of any personal data in your input and output and scrapesage acts only as your processor: that data is processed solely to run your job, written only to your own Apify storage, never used for any other purpose and never shared onward. If you need help with a data-subject request that involves this Actor's output, open an issue on the Issues tab.

### Disclaimer

**This Actor is an independent tool and is not affiliated with, endorsed by, or sponsored by Telegram or any of its subsidiaries. All trademarks mentioned are the property of their respective owners.**

"Telegram" and any related marks are the property of their respective owners and are used here only in a descriptive, nominative sense - to identify the publicly accessible website from which this Actor collects data. This Actor is not an official Telegram product, is not authorised or certified by Telegram, and does not distribute Telegram software. It collects only publicly available information; you are responsible for ensuring your use of that data complies with applicable laws, regulations and the terms of the source website.

### Need help?

Open an issue on the actor's **Issues** tab, or visit the [Apify help center](https://help.apify.com/). Feature requests are welcome — this actor is actively maintained.

# Actor input Schema

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

Public Telegram channels to scrape. Accepts @username, plain username, or t.me/username URL (also t.me/s/username). Private/invite-only channels are not supported.

## `resultsType` (type: `string`):

Scrape messages from each channel, or only the channel's metadata/stats.

## `maxMessages` (type: `integer`):

Maximum number of messages to scrape from each channel. Ignored when 'What to scrape' is 'Channel info only'.

## `searchQuery` (type: `string`):

Optional. When set, only messages matching this keyword are returned for each channel (uses Telegram's native in-channel search). Leave empty to scrape the full timeline.

## `oldestMessageDate` (type: `string`):

Optional. Stop scraping a channel once messages older than this date are reached. Accepts ISO date (e.g. 2026-01-01) or relative values like '7 days', '3 months'.

## `newestMessageDate` (type: `string`):

Optional. Skip messages newer than this date. Accepts ISO date or relative values like '1 day'.

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

Download photos/videos/documents attached to messages into the run's key-value store and add a reference to each record. Media URLs are always included regardless of this setting.

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

Proxy settings. Telegram's public web preview is lenient, but a proxy improves reliability at scale. Apify Proxy (datacenter) recommended.

## `urlsFromFile` (type: `string`):

Paste a list of channel URLs (one per line), OR one link to a .txt/.csv file, Google Sheet or Google Drive file containing them. Lets you import many channels at once instead of typing each into the field above. Google Sheet/Drive share links are handled automatically.

## Actor input object example

```json
{
  "channels": [
    "@telegram",
    "https://t.me/durov"
  ],
  "resultsType": "messages",
  "maxMessages": 100,
  "downloadMedia": false,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

One record per Telegram message (in 'messages' mode) or per channel (in 'channelInfo' mode), stored in the default dataset.

## `media` (type: `string`):

Photos, videos, voice notes, and documents downloaded into the default key-value store when 'Download media files' is enabled.

# 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",
        "durov"
    ],
    "urlsFromFile": ""
};

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

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

```

## MCP server setup

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