# Telegram Keyword Search (`datahamster/telegram-keyword-search`) Actor

Telegram keyword search across public channels: finds channels for your keyword and returns every matching post from Telegram's own in-channel search with text, date, views, reactions and media type. Monitor mode alerts on new posts. No login, no API key.

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

## Pricing

from $1.36 / 1,000 result items

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
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

## Telegram Keyword Search

Search public Telegram channels for a keyword and get one row per matching post: channel, post URL, text, date, views, reactions, media type and the source channel of a forward. The actor finds the channels for you (or takes your list) and asks each channel's public preview with Telegram's own in-channel search, so a row is a real post that matched, not a search-engine snippet. No Telegram account, no phone number, no API key.

**Try it:** the prefilled example returns 15 rows in about 18 seconds and costs about $0.026. Results cost $1.70 per 1,000.

Coverage: Telegram has no public search across all channels. Discovery finds the channels the search-engine index knows for your keyword (usually 5-20 per keyword); inside each channel the search is Telegram's own and goes back through the whole public history, 20 matches per page.

### Why this one

Compared with the most-used actor for this phrase (lofomachines/telegram-keyword-search-scraper, 564 users in 30 days; its README and input schema checked 2026-11-09):

- **Every matching post in a channel, not one post per search hit.** Its keyword mode "extracts the newest message on each discovered preview page" and warns the post "may not contain your keyword". Here each channel is searched with Telegram's own `?q=` search and paged back to the oldest match. Telegram's search also matches word forms, tickers and links, so every row carries `keywordInText`, and `exactMatch` keeps only the literal hits. Run gg19LECTm2qSUl6bX searched one channel for "ETF" and returned all 22 matching posts (two pages, 20 October to 9 November 2026), every one containing the word.
- **Monitor mode: new posts that mention your keyword.** Save the input as a task, set Mode to Monitor and schedule it: each run returns only posts published since the last run, across every channel the monitor has found for the keyword so far (channels found once are remembered and re-checked even when the search index stops listing them). The first run is a free baseline. Optional webhook or Telegram bot alert. The leader has no monitor mode. Proof: a baseline at 16:02 UTC on 9 November 2026 for "bitcoin" and "usdt" (run kVlNrueOzGLd6AKT3, 148 posts recorded, nothing charged), then run 1iCr6rla6BaXWRsAV 24 minutes later pushed exactly the 5 posts published in between (Whale Alert, Bitcoin, Bitcoin News, 16:11 to 16:24 UTC).
- **Keyword search inside channels you choose.** List channels in `channels` and the keyword is searched inside them, together with discovered ones, in one run. The leader's channel mode takes no keyword.
- **Filters in the input:** `postedAfter` (date or "7 days"), `minViews`, `exactMatch`. The leader has date bounds but no view or exact-match filter.
- **Price:** $1.70 per 1,000 posts against the leader's $2.50 per 1,000; platform usage is paid by you and stays small because no proxy is used.

### What you get

| Field | Example |
|---|---|
| `url` | `https://t.me/examplenews/7725` |
| `channel`, `channelTitle`, `channelSubscribers` | `examplenews`, `Example News`, `19000` |
| `text` | full post text |
| `postedAt` | `2026-11-09T07:51:46+00:00` |
| `views` / `viewsText` | `1490` / `1.49K` |
| `reactions` | `9` (sum of the reaction counters) |
| `mediaType`, `mediaTypes`, `imageUrls` | `photo`, `["photo"]`, image links |
| `links` | links inside the text |
| `isForwarded`, `forwardedFromChannel`, `forwardedFromUrl` | the source channel of a forward, when it is a public channel |
| `isReply` | `false` |
| `mentionCount` | `1` (person @handles masked as `@user` in this post) |
| `keyword`, `keywordInText`, `rank`, `source` | `bitcoin`, `true`, `1` (newest match first), `discovered` or `channel` |

Real rows from the prefilled run (keyword `bitcoin`, 4 channels found, 15 posts):

| `url` | `postedAt` | `views` | `reactions` | `mediaType` | `text` (start) |
|---|---|---|---|---|---|
| https://t.me/bitcoinnews/16410 | 2026-11-09T11:56:02+00:00 | 58 | 1 | photo | BITCOIN ETFs LOSE $1.28 BILLION IN THEIR WORST WEEK SINCE JUNE |
| https://t.me/bitcoin/20733 | 2026-11-09T15:49:58+00:00 | 446 | 8 | link | Strategy added 1,036 Bitcoin and repurchased $188.3 million of STRC |
| https://t.me/BitcoinBullets/17374 | 2026-11-09T03:39:15+00:00 | 3740 | | photo | #BTC Market Analysis. BTC is at 75,101.48 on the weekly |

### How it works

1. **Discovery.** Each keyword is searched in a public search-engine index restricted to `t.me` (Yahoo, DuckDuckGo as fallback). Post links and preview links collapse into their channel.
2. **In-channel search.** Every channel is opened at `t.me/s/<channel>?q=<keyword>`, the public web preview Telegram serves to anyone. Groups, personal accounts, bots and channels without a public preview answer with a plain card and are skipped, so nothing is read from them.
3. **Paging.** Newest matches first, 20 per page, older pages until `maxPostsPerChannel`, `postedAfter` or the last match.
4. **Empty runs explain themselves.** `RUN_SUMMARY` in the run's key-value store has `emptyReason`: `no_matches` when the channels answered "No posts found", `blocked` when Telegram or the search engines refused the requests. A refused run is never reported as "no matches".

### Input

| Field | Meaning | Default |
|---|---|---|
| `keywords` | Words or phrases to search | `["bitcoin"]` |
| `channels` | Channels to search in, besides discovered ones | empty |
| `discoverChannels` | Find channels automatically | `true` |
| `channelsPerKeyword` | Discovered channels searched per keyword (1-50) | `5` |
| `maxPostsPerChannel` | Newest matching posts per channel (1-1000) | `20` |
| `postedAfter` | `2026-11-01` or `7 days` | empty |
| `minViews` | Minimum views | empty |
| `exactMatch` | Keep only posts whose text contains the keyword | `false` |
| `maxItems` | Stop after this many rows | `100` |
| `mode`, `monitorStateId`, `webhookUrl`, `telegramBotToken`, `telegramChatId` | Monitor mode and alerts | `scrape` |

### Monitor mode

Run the input as a saved task with Mode = Monitor (or pass a `monitorStateId`). The first run of each keyword and channel records what exists and pushes nothing (free baseline, `emptyReason: baseline`). Later runs push only posts that were not there before, newer than the last run minus 6 hours, and charge one `monitor-check` per run plus one `change` per new post. Channels discovered for a keyword are kept in the monitor's key-value store (up to 4 x `channelsPerKeyword` per keyword) and read on every run. If a monitor run is killed, the next run of the same task waits until that run's timeout before it reads again (`emptyReason: overlapping_run`).

### Pricing

| Event | Price |
|---|---|
| result | $0.0017 per post ($1.70 per 1,000) |
| monitor-check | $0.005 per monitor run |
| change | $0.0017 per new post in monitor mode |

Store discounts: Silver 10% off, Gold and higher 20% off. Platform usage is paid by you; the actor uses no proxy and runs in 512 MB.

**Found it useful?** A short review on the Store page helps other people find this actor. If something is wrong, open an issue on the actor page.

### Related actors

- [Telegram Channel Search Scraper](https://apify.com/datahamster/telegram-channels-search): find channels and groups by topic with subscriber counts.
- [Telegram Groups Search](https://apify.com/datahamster/telegram-groups-search): public groups only, with member and online counts.
- [Telegram Channel Scraper & Channels Search](https://apify.com/datahamster/telegram-public-channels): full post history of known channels.
- [Reddit Scraper](https://apify.com/datahamster/reddit-scraper): keyword search in another community network.

### Limits

- Only public channels with a web preview can be searched. Groups and private channels are not readable without an account.
- Discovery depends on the search-engine index; a channel never linked on the open web is found only if you list it in `channels`.
- Telegram's search matches word forms, hashtags and links too, so some posts do not contain the literal keyword; `keywordInText` and `exactMatch` handle that.
- `views` is the rounded counter Telegram prints (`1.49K`); the raw text is in `viewsText`.
- No member lists and no personal data: posts are published by channels. Author signatures are not returned, and a forward from a person keeps only `isForwarded: true`, never the name or link.
- Person handles: every @handle and bare t.me/<name> link in the post text and `links` other than the row's own is replaced with `@user` / `t.me/user` unless its t.me card shows a public channel or group (one card check per handle, at most 40 per run; handles beyond that are masked unchecked). Post links t.me/<name>/<id> and invite links stay. `mentionCount` says how many were masked.

### FAQ

**Does it need a Telegram account or API key?** No. Every request is a plain public web request.

**Can it search all of Telegram?** No tool can without an account; Telegram has no public global search. This actor covers the channels it can find or that you give, and inside them every matching post.

**Why did a run return nothing?** Open `RUN_SUMMARY` in the run's key-value store: `emptyReason` says whether nothing matched or the requests were refused, with counters for channels read, skipped and walled.

### Changelog

- 0.1: first release. Channel discovery plus Telegram in-channel search, filters, monitor mode with remembered channels.

# Actor input Schema

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

Words or phrases to find in public Telegram channel posts, one per line, e.g. "bitcoin", "remote job", "openai". Each keyword is searched with Telegram's own in-channel search in every channel of the run. Any language works.

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

Optional public channels to search, e.g. "https://t.me/telegram", "t.me/s/durov" or "@bbcnews". They are searched for every keyword, in addition to the channels found automatically. Leave empty to rely on discovery.

## `discoverChannels` (type: `boolean`):

Find public channels for each keyword in the search-engine index of t.me and search them too. Turn off to search only the channels you listed.

## `channelsPerKeyword` (type: `integer`):

How many automatically found channels to search for each keyword, e.g. 5. Groups, personal accounts and channels without a public preview are skipped and do not count. Range 1-50.

## `maxPostsPerChannel` (type: `integer`):

Newest matching posts to return from each channel, e.g. 20. Telegram serves 20 matches per page; older pages are read until this number, the date window or the end of the matches is reached.

## `postedAfter` (type: `string`):

Optional. Keep only posts published on or after this date: "2026-11-01", "2026-11-01T12:00:00Z", or relative like "7 days", "12 hours", "2 weeks". Reading a channel stops once older posts are reached.

## `minViews` (type: `integer`):

Optional. Keep only posts with at least this many views, e.g. 1000.

## `exactMatch` (type: `boolean`):

Telegram's search also matches word forms, hashtags and links. Turn on to keep only posts whose text contains every word of the keyword. Every row also carries keywordInText, so you can filter later instead.

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

Stop after this many results (you are charged only for pushed items)

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

scrape = full results; monitor = only new/changed items since the previous run of this task

## `monitorStateId` (type: `string`):

Optional state id when not running as a saved task (monitor mode)

## `webhookUrl` (type: `string`):

POST a change summary here in monitor mode

## `telegramBotToken` (type: `string`):

Optional: bot token for monitor-mode change summaries

## `telegramChatId` (type: `string`):

Optional: chat id that receives monitor-mode summaries

## Actor input object example

```json
{
  "keywords": [
    "bitcoin"
  ],
  "discoverChannels": true,
  "channelsPerKeyword": 4,
  "maxPostsPerChannel": 5,
  "exactMatch": false,
  "maxItems": 20,
  "mode": "scrape"
}
```

# Actor output Schema

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

All pushed rows (dataset, JSON)

## `resultsTable` (type: `string`):

Dataset in the Console viewer

## `runSummary` (type: `string`):

RUN_SUMMARY record

# 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 = {
    "keywords": [
        "bitcoin"
    ],
    "channelsPerKeyword": 4,
    "maxPostsPerChannel": 5,
    "maxItems": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("datahamster/telegram-keyword-search").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 = {
    "keywords": ["bitcoin"],
    "channelsPerKeyword": 4,
    "maxPostsPerChannel": 5,
    "maxItems": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("datahamster/telegram-keyword-search").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 '{
  "keywords": [
    "bitcoin"
  ],
  "channelsPerKeyword": 4,
  "maxPostsPerChannel": 5,
  "maxItems": 20
}' |
apify call datahamster/telegram-keyword-search --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,datahamster/telegram-keyword-search"
        }
    }
}
```

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/zaf9QW1gWV9hsQMMB/builds/PO09L5XcgrgY8xY5f/openapi.json
