# Telegram Keyword Scraper: Search Posts in Public Channels (`xmolodtsov/telegram-keyword-scraper`) Actor

Scrape telegram keyword matches in public channels you supply. Export post text, dates, views, reactions and media URLs with bounded history scanning. No account required.

- **URL**: https://apify.com/xmolodtsov/telegram-keyword-scraper.md
- **Developed by:** [GoFetch](https://apify.com/xmolodtsov) (community)
- **Categories:** Social media, Automation
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.34 / 1,000 items

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?

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

This scraper for telegram keyword searches returns matching posts from **public channels you supply**. Enter channel usernames or URLs and literal keywords to export post text, dates, views, reactions and visible media links. It is channel-scoped: there is no Telegram-wide search without an account, and this actor does not provide one. No Telegram account, Bot API, MTProto, search engines or third-party catalogues are used.

### What data you get

One saved row represents one public channel post whose own text body or media caption contains at least one requested phrase. Each row includes every matching phrase in `matchedKeywords`, even when several keywords find the same post. Media-only posts, stickers and service notices (such as pinned-message or channel-rename notices) are excluded. Canonical `messageUrl` identifies a post, and `id` contains `channel/messageId` for downstream joins.

The output includes channel title, description, visible subscriber count and avatar; post text and HTML; publication date; visible view and reaction counts; forwarded source, reply context, links and media URLs. The author field contains only the name shown on the public post. Missing optional values are null or empty arrays. The actor does not fetch phone numbers, channel members or personal contact profiles. `textHtml` retains the published message markup, including line breaks. Plain `text` and `channelDescription` decode HTML entities, convert `<br>` elements to newlines and trim surrounding whitespace; other text labels are extracted as plain text with surrounding whitespace trimmed.

Use the data to follow announcements in channels you already know, compare discussion of a topic across selected publications, or feed matching posts into an internal report. This is a bounded public-preview export; it cannot establish complete coverage of Telegram.

### How to use it

In [Apify Console](https://console.apify.com/), open the actor, enter `channels` and `keywords`, choose a result limit, and select Start. The prefilled example uses two large official channels, `telegram` and `durov`, the evergreen phrase `telegram`, and ten results. Results appear in the default dataset; download JSON, CSV, Excel or other supported dataset exports.

Call the API with your Apify token in an authorization header:

```javascript
const response = await fetch(
  'https://api.apify.com/v2/acts/xmolodtsov~telegram-keyword-scraper/run-sync-get-dataset-items?timeout=120',
  {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.APIFY_TOKEN}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      channels: ['telegram', 'durov'],
      keywords: ['telegram'],
      maxItems: 10,
      maxScanPagesPerChannel: 10,
    }),
  },
);
if (!response.ok) throw new Error(`Run failed: ${response.status}`);
const posts = await response.json();
```

For longer scans, start an asynchronous run and retrieve its dataset after completion. An Apify MCP client can also call this actor using the same JSON input. Supply channels explicitly when asking an MCP assistant to search: a keyword alone is insufficient. See [Apify API documentation](https://docs.apify.com/api/v2) for runs and dataset access.

### Pricing

The saved-post event is the only actor charge. Duplicate discoveries, unmatched posts and failed requests produce no saved-post events.

| Apify plan | Price per 1,000 saved posts |
| --- | --- |
| FREE | $1.92 |
| BRONZE | $1.73 |
| SILVER | $1.54 |
| GOLD | $1.34 |

Platinum and Diamond use the Gold rate. For example, ten saved posts correspond to $0.0192 at the listed Free tier or $0.0134 at Gold; 200 posts correspond to $0.384 or $0.268 respectively. Apify's treatment of free-plan event charges follows its platform billing rules. The plan name in this table does not remove the developer's free quota.

Sparse phrases still require source requests. By default the actor reads up to ten history pages per channel and up to three additional native search pages for each keyword. Most history pages contain about twenty visible posts, but this varies. Increasing the history bound increases work even if it yields no rows. A result cap and the user's charge budget stop further work.

#### Is it free?

On the Apify free plan, this developer allows **100 results per run and 20 runs per month** per user. The monthly allowance resets on the first day of each UTC calendar month. After twenty admitted runs, another run succeeds with zero results and makes no source requests. The quota uses developer-owned storage and cannot be reset by changing input or caller storage. Paid plans have no developer free quota. The developer owner and platform TEST runs are exempt.

### Input

`channels` and `keywords` are both required. Channels accept public usernames, optional `@`, or HTTP(S) channel URLs on `t.me`, `telegram.me` and `telegram.dog`, including optional `www` and `/s/`. URL query parameters and fragments are ignored. Supply channel links rather than post, invite or internal `/c/` links. At most 100 channels and twenty phrases are accepted, with each phrase limited to 200 characters. Duplicate channels and case-equivalent phrases are combined.

Matching is a literal substring check on post text after Unicode NFC normalization and Unicode lowercase conversion. It is case-insensitive, supports non-ASCII text and treats punctuation literally. It does not interpret regular expressions, transliterate text or apply language-specific stemming. A phrase may match inside a longer word. `text`, `textHtml` and `links` come only from the post's own body or caption. Quoted reply parents, forwarded-source headers, link preview cards, polls and edited markers do not enter those fields or qualify a post. `replyTo` and `forwardedFrom` retain their separate context fields. Linked text and blockquotes published within the own body do qualify; album captions are retained once per post.

`maxItems` is a global saved-post limit, default 100, maximum 100,000. The Console prefill is ten. `maxScanPagesPerChannel` defaults to ten, from 1 to 1,000. Each channel's chronological history is scanned **once**, matching all phrases locally. Native `?q=` searches add older matches beyond that scan; Telegram's native search often stops after about 22 hits. It is not an exhaustive keyword index.

Optional `dateFrom` and `dateTo` accept inclusive `YYYY-MM-DD` dates in UTC; empty values disable the bound. History stops when a whole page is older than `dateFrom`. A `dateTo` filter does not jump over newer pages, which still consume the scan bound. Results are not globally sorted across channels.

`proxyConfiguration` defaults to Apify datacenter. Residential groups are rejected through both SDK aliases, `groups` and `apifyProxyGroups`, including mixed-case values; supported groups are automatic selection, `BUYPROXIES94952` and `SHADER`. Country, subdivision, tiered routes and unknown routing options are unsupported. Paid callers may supply HTTP(S) proxy URLs or explicitly disable Apify Proxy. SOCKS and other proxy protocols are rejected as `invalid:` before quota admission or source requests. Free runs ignore valid caller proxies and always use Apify datacenter. The resolved proxy class is recorded in STATISTICS. Memory defaults to 256 MB with a 512 MB maximum.

### Output

This example uses values from a real public-source run:

```json
{
  "id": "telegram/334",
  "channel": "telegram",
  "channelTitle": "Telegram News",
  "channelDescription": "The official Telegram on Telegram. Much recursion. Very Telegram. Wow.",
  "subscriberCount": 9090000,
  "subscriberCountLabel": "9.09M",
  "channelAvatarUrl": "https://cdn1.telesco.pe/file/nbSZNqRLY0v-sEAhdqB1GSbRgjI7dXcd44juoiLx2URFFOycwLB1_gPBD2FTgQ9guvpAVM5tm9ZTSR_Hw_f3VJoxJOdwVfreiLPRPyKDsvPm-MZHq4Ih1g7BCiVpZadIXjM0LhbCaeTkGq_UhsbdFvgWYaI8PUqZ0cFyzIQmr_VgPTCWycxaRf3r33HCYVvNUmyCajjk3OR3K_k7pgioIDqdir7Zhuy0CALHkqxeAM6JOxYa5m21J33mu1h37fE18tZPpzNDCna-FGVtO_1JV58b9sUwRkJqdTONH6GF1sinxlEPpOqzecaUo--VbkpQsLIAjkz332vp_AhQU5Kn4w.jpg",
  "isVerified": true,
  "messageId": 334,
  "messageUrl": "https://t.me/telegram/334",
  "text": "Due to the recent events in the Middle East, particularly in Israel, Lebanon, and Iran, Telegram experienced unprecedented loads. In the past few days, some users may have faced temporary connection issues and difficulties accessing media. Thanks to our technical team's efforts, Telegram remained available in most countries, and all issues are now fully resolved. We apologize for any inconvenience.",
  "textHtml": "Due to the recent events in the Middle East, particularly in Israel, Lebanon, and Iran, Telegram experienced unprecedented loads. In the past few days, some users may have faced temporary connection issues and difficulties accessing media. Thanks to our technical team's efforts, Telegram remained available in most countries, and all issues are now fully resolved. We apologize for any inconvenience.",
  "date": "2024-10-04T15:57:08+00:00",
  "views": 4900000,
  "viewsLabel": "4.9M",
  "author": null,
  "reactions": [],
  "forwards": null,
  "forwardedFrom": null,
  "forwardedFromUrl": null,
  "replyTo": null,
  "links": [],
  "media": [],
  "matchedKeywords": [
    "telegram"
  ]
}
```

![Matching public channel posts output preview](https://api.apify.com/v2/key-value-stores/2DxCOvbMjhvK3S1qP/records/telegram-keyword-scraper-output.png)

Counts reflect the public preview at collection time. Abbreviated view, subscriber and reaction counts are converted to numbers and remain approximate. `viewsLabel` and `subscriberCountLabel` retain the displayed labels. Reactions retain custom emoji IDs and a paid-reaction flag where present. Media links point to the visible source asset; no files are downloaded, and CDN links may expire. `textHtml` is untrusted source HTML: sanitize it before rendering.

### Guarantees and failure semantics

Every saved post matches at least one requested phrase. Rows are deduplicated by canonical message URL before persistence. On restart, saved dataset URLs seed deduplication through an empty dataset page. A pending uncertain append stops further source work instead of retrying an append that might already have saved rows. Saved rows remain available after later failures; such runs succeed with partial results and record the incomplete channel in STATISTICS.

With zero saved rows, a run is FAILED if any channel could not return a usable public preview or complete within its documented bounds. Status messages begin with `blocked:`, `network:`, `timeout:`, `invalid:` or `outdated:`. Invalid covers missing usernames, private/no-preview channels, accounts, bots and groups; these receive input-level notes. If all channels are invalid, the run fails `invalid:` rather than claiming no results. Mixed valid and invalid channels can produce a successful partial dataset when rows were saved.

A zero-row “No results” success requires every supplied channel to return a valid public preview and every search/scan to complete or reach its documented page/date bound without matches. Quota refusal and a user charge-limit stop have separate explicit messages. HTTP status and challenge layout determine blocks; words such as captcha in a post do not.

STATISTICS contains per-channel history and search page counts, `exhausted`, `limited`, stop reasons, next cursors and input notes. A page, date, time, result or charge cap means bounded coverage, never history exhaustion. `completedInputs` counts only fully exhausted units; native-search completion alone says nothing about the entire history. Partial failures are visible even when other channels produce rows. Requests have bounded timeouts, one fresh-session retry and strictly decreasing, unrepeated cursors. Work stops before the run deadline.

### Integrations

Use [Apify integrations](https://apify.com/integrations) to send dataset rows to your existing workflow. Schedules can repeat the same known-channel scan; webhooks can notify your application when a run finishes. Dataset exports work with spreadsheets and BI tools. For incremental collection across separate runs, keep `messageUrl` as the unique key in your destination: this actor deduplicates within a run and its restarts, not across independent runs.

### More scrapers from this developer

**TikTok:** [TikTok Search Scraper](https://apify.com/xmolodtsov/tiktok-search-scraper): videos and creators for any keyword, pay per result ·
[TikTok Profile Scraper (Pay Per Result)](https://apify.com/xmolodtsov/tiktok-profile-scraper): profiles, followers and latest posts by username ·
[TikTok Comments Scraper](https://apify.com/xmolodtsov/tiktok-comments-scraper): comments and full reply threads from any video ·
[TikTok Hashtag Scraper](https://apify.com/xmolodtsov/tiktok-hashtag-scraper): videos for any hashtag, with views, likes and music ·
[TikTok Sound & Music Scraper](https://apify.com/xmolodtsov/tiktok-sound-scraper): videos that use a sound or song ·
[TikTok Top Ads Scraper](https://apify.com/xmolodtsov/tiktok-top-ads-scraper): public Creative Center ad rankings, engagement, media and landing pages

**Social & news:** [Reddit Search Scraper](https://apify.com/xmolodtsov/reddit-scraper): posts by keyword, subreddit or author ·
[Google News Scraper](https://apify.com/xmolodtsov/google-news-scraper): google News results as clean full-text articles ·
[Threads Replies Scraper](https://apify.com/xmolodtsov/threads-replies-scraper): public post replies, likes, authors and inline nested replies ·
[Threads Posts Scraper](https://apify.com/xmolodtsov/threads-posts-scraper): public profile timelines with likes, replies and reposts ·
[Pinterest Videos Scraper](https://apify.com/xmolodtsov/pinterest-videos-scraper): public Pinterest videos by keyword or board, with MP4 links and stats

**Instagram:** [Instagram Reel Scraper](https://apify.com/xmolodtsov/instagram-reel-scraper): public profile reels, plays, captions, music and media URLs ·
[Instagram Comment Scraper](https://apify.com/xmolodtsov/instagram-comment-scraper): public post and reel comments, likes, timestamps and usernames ·
[Instagram Post Scraper](https://apify.com/xmolodtsov/instagram-post-scraper): public profile posts, likes, captions, locations and media URLs

**E-commerce:** [Prom.ua Product Search Scraper](https://apify.com/xmolodtsov/prom-ua): prom.ua product search results, no browser needed ·
[Amazon Product Search & Bestsellers Scraper](https://apify.com/xmolodtsov/amazon-search-scraper): search results, product details from Amazon ·
[AliExpress Search Scraper](https://apify.com/xmolodtsov/aliexpress-search-scraper): aliExpress products by keyword with prices, orders and shipping ·
[AliExpress Product Reviews Scraper](https://apify.com/xmolodtsov/aliexpress-reviews-scraper): public product reviews, ratings, buyer photos and follow-up feedback

**Maps & leads:** [Google Maps Scraper](https://apify.com/xmolodtsov/google-maps-scraper): places, leads and emails from Google Maps

**Ads:** [Facebook Ad Library Scraper (Meta Ads Library)](https://apify.com/xmolodtsov/facebook-ads-library-scraper): ads from the Meta Ad Library, with EU reach and payers ·
[Google Ads Transparency Scraper](https://apify.com/xmolodtsov/google-ads-transparency-scraper): google ad creatives by advertiser or domain, with regional details

**Video:** [YouTube Transcript Scraper](https://apify.com/xmolodtsov/youtube-transcript-scraper): transcripts, subtitles and captions from YouTube videos ·
[YouTube Shorts Scraper](https://apify.com/xmolodtsov/youtube-shorts-scraper): shorts of any channel with exact views, likes and duration ·
[YouTube Channel Scraper](https://apify.com/xmolodtsov/youtube-channel-scraper): every video of a channel, with channel stats ·
[YouTube Search Scraper](https://apify.com/xmolodtsov/youtube-search-scraper): search results and videos for any keyword ·
[YouTube Comments Scraper](https://apify.com/xmolodtsov/youtube-comments-scraper): comments, replies and likes from any video ·
[Bilibili Comments Scraper](https://apify.com/xmolodtsov/bilibili-comments-scraper): public hot comments and reply threads by video or keyword

**Jobs:** [SEEK Job Listings Scraper](https://apify.com/xmolodtsov/seek-jobs-scraper): public AU/NZ job listings, salaries and redacted descriptions

### FAQ

#### Does it search all Telegram channels?

No. You must supply public channel usernames or URLs in `channels` and phrases in `keywords`. There is no anonymous Telegram-wide search here, and the actor does not discover channels or use an account. Accounts, bots, private channels and groups do not qualify as broadcast-channel previews.

#### Why are older matching posts missing?

The default history scan is bounded, and Telegram's native keyword search exposes a small subset. Raise `maxScanPagesPerChannel` if deeper coverage justifies additional work. Read each channel's STATISTICS coverage before treating a dataset as complete. Deleted, restricted or preview-hidden posts cannot be recovered.

#### Is it legal to scrape public channel posts?

This actor accesses public data without authentication. Public availability does not remove your responsibilities: choose a lawful purpose, minimize retained information and respect applicable terms, copyright, GDPR and CCPA obligations. Do not use the output for personal-contact enrichment or to bypass access restrictions.

#### Does a zero-result run prove the keyword never appeared?

Only within the accessible preview and documented bounds. A successful empty run records its coverage; a channel error produces a failure or a partial-result note. A limited history is not a complete absence claim.

### Support

Open the actor's Issues tab on [Apify](https://apify.com/xmolodtsov/telegram-keyword-scraper) with the run ID, requested public channel, expected message URL and coverage notes. Never include tokens, cookies or private channel content. For platform API and export help, use [Apify documentation](https://docs.apify.com/platform).

# Changelog

This Actor's version history is a separate document: https://apify.com/xmolodtsov/telegram-keyword-scraper/changelog.md

# Actor input Schema

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

Required public channel usernames or HTTP(S) t.me, telegram.me or telegram.dog channel URLs, optionally /s/. Channel-scoped search only; no Telegram-wide search without an account. Maximum 100 channels.

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

Required literal phrases to find in the post's own text body or media caption, excluding quoted reply parents, forwarded headers, link previews, polls and service notices. Unicode NFC normalization and case-insensitive Unicode lowercasing; no regular expressions. Matches any phrase; matchedKeywords lists all matches. Maximum 20 phrases, 200 characters each.

## `maxItems` (type: `integer`):

Maximum saved posts across all supplied channels. Apify free plan: 100 results per run, 20 runs per month. These are developer limits, reset each UTC month. Paid plans have no developer free quota.

## `maxScanPagesPerChannel` (type: `integer`):

Scan each channel history once, matching every keyword locally. Default 10 pages (usually around 200 posts). Sparse phrases still cost pages without results. Also request up to 3 native search pages per keyword to add older hits; page bounds mean limited coverage, not exhaustion.

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

Optional inclusive YYYY-MM-DD UTC date. Stop history scanning once the page is older than this date. Empty means no lower date bound.

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

Optional inclusive YYYY-MM-DD UTC date. Newer posts are filtered out; they still consume scanned pages. Empty means no upper date bound.

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

Apify datacenter by default (automatic, BUYPROXIES94952 or SHADER via groups/apifyProxyGroups). Residential, country/subdivision, tiered routes and non-HTTP(S) proxy URLs are rejected before admission. Paid callers may use HTTP(S) proxy URLs or direct access. Free runs ignore valid custom URLs and always use Apify datacenter.

## Actor input object example

```json
{
  "channels": [
    "telegram",
    "durov"
  ],
  "keywords": [
    "telegram"
  ],
  "maxItems": 10,
  "maxScanPagesPerChannel": 10,
  "dateFrom": "",
  "dateTo": "",
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `results` (type: `string`):

Unique public channel posts matching their own body or caption, with text, date, views, reactions and visible media URLs. Quoted reply parents and service notices never qualify a post.

## `statistics` (type: `string`):

Per-channel exhausted or limited coverage, source failures and scan page counts.

# 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"
    ],
    "keywords": [
        "telegram"
    ],
    "maxItems": 10,
    "maxScanPagesPerChannel": 10,
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("xmolodtsov/telegram-keyword-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",
    ],
    "keywords": ["telegram"],
    "maxItems": 10,
    "maxScanPagesPerChannel": 10,
    "proxyConfiguration": { "useApifyProxy": True },
}

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

```

## MCP server setup

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