# Telegram Channel Monitor (`headlessagent/telegram-channel-monitor`) Actor

Collect new posts and media from public Telegram channel previews.

- **URL**: https://apify.com/headlessagent/telegram-channel-monitor.md
- **Developed by:** [Headless Agent](https://apify.com/headlessagent) (community)
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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 Monitor

Collect new posts from public Telegram channels, including text, timestamps, view counts, author attribution, media links and public post URLs. Schedule repeat runs to receive new posts without repeating posts already delivered.

Supply a channel username, an `@username`, or its public channel URL. Private channels and channels without a public preview produce a warning while other channels continue. A run fails if every channel fails.

| Input | Description |
| --- | --- |
| `channels` | Required list of public channels, maximum 50. |
| `maxPosts` | Most recent matching posts per channel per run. Default 100, maximum 1,000. A bounded scan may return fewer. |
| `sinceMessageId` | Optional floor: only message IDs greater than this value are eligible. |
| `keyword` | Optional case-insensitive substring filter on post text. |
| `includeMedia` | Include exposed media URLs. Default true. False keeps the post and media type but returns an empty media URL list. |
| `stateKey` | Monitoring profile name. Keep the same value for scheduled runs; default `telegram-channel-monitor-state`. |

Example input:

```json
{"channels":["durov"],"maxPosts":100,"includeMedia":true}
```

| Output | Description |
| --- | --- |
| `channelUsername`, `channelTitle` | Public channel username and display title. |
| `messageId`, `url` | Message identifier and public post link. |
| `date` | Post timestamp in UTC. |
| `text`, `textHtml` | Plain text and original formatted text. Sanitize HTML before displaying it in a browser. |
| `mediaType` | photo, video, voice, poll, document, or none. |
| `mediaUrls` | Available media links; these can expire. Files are not downloaded. |
| `linkPreviewUrl` | Linked preview destination, or null. |
| `views` | Approximate view count, or null when absent. |
| `forwards` | Null when no forward count is exposed; currently unavailable. |
| `author`, `forwardedFrom` | Visible author and forwarded attribution, or null. |
| `isReply` | Whether reply markup is shown. |
| `observedAt` | Observation timestamp in UTC. |

Example result:

```json
{"channelUsername":"durov","channelTitle":"Pavel Durov","messageId":531,"url":"https://t.me/durov/531","date":"2026-07-16T20:45:25.000Z","text":"🩵 Telegram now has a Rich Text Editor.\n\nIt supports tables, headings, inline media, lists, AI content, formulas, and more.\n\n😈 Messaging apps will never be the same!","textHtml":"🩵 Telegram now has a <b>Rich Text Editor</b>.<br><br>It supports tables, headings, inline media, lists, AI content, formulas, and more.<br><br>😈 Messaging apps will never be the same!","mediaType":"video","mediaUrls":[],"linkPreviewUrl":null,"views":5850000,"forwards":null,"author":"Pavel Durov","forwardedFrom":null,"isReply":false,"observedAt":"2026-10-27T16:00:00.000Z"}
```

Each channel's selected posts are delivered oldest-first. The first run collects a recent snapshot up to your limit. Later runs collect only posts newer than the last delivered message; older posts outside the initial snapshot are not backfilled. Changing a keyword does not replay older posts, and edits to delivered posts are not repeated. Use a new monitoring profile to start a fresh snapshot.

Run one schedule at a time for each profile. Interrupted delivery can repeat the last batch. Public preview availability and formatting can change; unrecognized pages are reported as channel warnings. Runs that successfully find no new posts return zero results.

# Actor input Schema

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

Public usernames, @usernames, or channel URLs; maximum 50.

## `maxPosts` (type: `integer`):

Most recent matching posts per channel per run.

## `sinceMessageId` (type: `integer`):

Only posts with IDs greater than this value.

## `keyword` (type: `string`):

Optional case-insensitive substring of the post text.

## `includeMedia` (type: `boolean`):

Include available media links without downloading files.

## `stateKey` (type: `string`):

Keep the same profile on scheduled runs to receive only new posts.

## Actor input object example

```json
{
  "channels": [
    "durov"
  ],
  "maxPosts": 100,
  "includeMedia": true,
  "stateKey": "telegram-channel-monitor-state"
}
```

# Actor output Schema

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

Collected public channel posts.

# 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"
    ],
    "maxPosts": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("headlessagent/telegram-channel-monitor").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"],
    "maxPosts": 100,
}

# Run the Actor and wait for it to finish
run = client.actor("headlessagent/telegram-channel-monitor").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"
  ],
  "maxPosts": 100
}' |
apify call headlessagent/telegram-channel-monitor --silent --output-dataset

```

## MCP server setup

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

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/CwhfeEdxgOsFgb3di/builds/lv672SauHzwLLw3dn/openapi.json
