# Telegram Channel Message Scraper (`akula.marketing/telegram-get-chat-messages-channel-comments`) Actor

Scrape Telegram channel messages and group chat posts with author profiles. Delivers Excel export via webhook for lead gen and conversation analysis.

- **URL**: https://apify.com/akula.marketing/telegram-get-chat-messages-channel-comments.md
- **Developed by:** [akula.marketing](https://apify.com/akula.marketing) (community)
- **Categories:** Social media, Lead generation, Other
- **Stats:** 66 total users, 1 monthly users, 100.0% runs succeeded, 5 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $85.00 / 1,000 runs

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

## Telegram Get Chat Messages / Channel Comments

> 💬 Questions, bulk pricing, or a custom solution? Talk to us on Telegram — [@KoteamSupport](https://t.me/KoteamSupport).

Actor to get the Excel file containing messages and their authors' account information from a Telegram channel or chat.
This Actor collects all messages and users who have posted messages in Telegram channels or Chat, sorted by the most recent activity. Each scraping session is limited to 10 minutes but can be resumed from the last checkpoint, allowing for unlimited data collection without quantity restrictions.
This actor is designed for efficient and flexible Telegram user data collection, suitable for further analysis or integration with other tools.

Actor use public Telegram API's [channels.getMessages](https://core.telegram.org/method/channels.getMessages) method to create a parsing task for gathering Telegram channel information about messages and comments.

- **Parsing Time**: The approximate time to complete the parsing task is about 5 minutes.

To get more functionality use [akula.marketing](https://akula.marketing/en)

### 📥 Input

The Actor accepts the following input fields:

- **username**: The Telegram channel username or ID (e.g., `@channelname` or `channelname`).
- **webhookUrl**: The URL where the parsing results will be sent.

The task of Telegram channel parsing takes a few minutes to complete, so the Actor uses asynchronous logic. You must provide a webhook URL to receive the results. You can use your own URL or try online services for testing, such as [webhook.site](https://webhook.site), which we recommend for this purpose.
Example of webhook events are available [here](https://webhook.site/#!/view/6fc27cda-2109-4dff-b4f7-b85cc33825ac/162677d1-0e0d-454c-9473-1bb985dd1fbc/1)
![webhook.site example](https://viper-public.s3.eu-north-1.amazonaws.com/webhook_site_screenshot.jpg)

#### 📋 Input Schema

| Field            | Type    | Description                                              | Required | Default                                    |
|------------------|---------|----------------------------------------------------------|----------|--------------------------------------------|
| `username`       | String  | Telegram channel username or ID                          | Yes      | `devs`                                     |
| `webhookUrl`     | String  | Webhook URL to receive parsing results                   | Yes      | `https://webhook.site/6fc27cda-...`        |
| `max_message_id` | Integer | Offset message ID (only messages before this ID will be retrieved). Exclusive. Minimum: 0. | No       | None                                       |
| `min_message_id` | Integer | Excludes messages with an ID lower than or equal to this value. Minimum: 0. | No       | None                                       |
| `keep_duplicates`| Boolean | Whether to keep duplicate participants in the results.   | No       | `false`                                    |

The username can be provided as `@channelname`, `channelname`, or a Telegram URL like `https://t.me/channelname`.

### 📤 Output

The Actor outputs a dataset with the following fields:

| Field     | Type   | Description                              |
|-----------|--------|------------------------------------------|
| `result`  | String | Status of the task (`success` or empty)  |
| `error`   | String | Error message (if any)                   |

#### Example Output

```json
{
  "result": "success",
  "error": null
}
```

### 📬 Webhook Output

The Actor sends parsing results to the provided `webhookUrl` as a JSON object (`ProgressUpdate`) with the following fields:

| Field                     | Type   | Description                                                                 |
|---------------------------|--------|-----------------------------------------------------------------------------|
| `TaskId`                  | String | Unique identifier for the parsing task                                      |
| `ChannelTelegramId`       | String | Telegram ID of the channel being parsed                                     |
| `ExecutionTime`           | String | Duration of the parsing task execution                                      |
| `State`                   | String | Task status (`started`, `in_progress`, `completed`, `error`)                |
| `UsersCount`              | String | Current number of users parsed from the channel                             |
| `UsersWithUsernamesCount` | String | Current number of users with usernames parsed from the channel              |
| `UserIdsS3Key`            | String | S3 key for the file containing user IDs                                     |
| `XlsxS3Key`               | String | S3 key for the Excel file containing parsed data                            |
| `Timestamp`               | String | Timestamp of the update in RFC3339 format (e.g., `2025-08-29T08:26:00Z`)    |
| `Error`                   | String | Error message (if any), e.g., admin privilege issues or restricted output   |

### Webhook Error Messages

If the output is restricted due to subscription limits:
`Output is restricted. To use without limitations upgrade to a paid subscription.`

### Example Webhook Payload

```json
{
  "task_id": "gp-123",
  "channel_telegram_id": "123",
  "execution_time": "2.551467402",
  "state": "completed",
  "users_count": "10",
  "users_with_usernames_count": "8",
  "user_ids_s3_key": "s3_link",
  "xlsx_s3_key": "s3_link",
  "timestamp": "2025-08-28T13:15:50Z",
  "error": "Output is restricted. To use without limitations upgrade to a paid subscription"
}
```

### File Output

The actor generates two output files:

1. **Text File**: Contains a list of usernames, reusable in other software.
2. **Excel File**: Includes detailed data for each discovered Telegram account:

```json
Channel Name
User ID
First Name
Last Name
Username
Has Profile Photo (Yes/No)
Phone Number
Premium Status (Yes/No)
Online Status
Language
Bio (About)
Message Date
Message Text
```

![excel result example](https://viper-public.s3.eu-north-1.amazonaws.com/devs_gm_excel_screenshot.jpg)
To refine the collected data, it is recommended to filter the database based on: Presence of a profile photo, Online status, Keywords in the "Bio" (About) field.

### Usage

1. **Input Username**: Provide a Telegram channel username (e.g., `devs`, `@devs`, or `https://t.me/devs`).
2. **Input Webhook URL**: Provide a webhookUrl where the parsing results will be sent.
3. **Run the Actor**: Execute to fetch recommended channels.
4. **Monitor Results**: Check the provided webhook URL for the participant data. The XlsxS3Key field provides a link to download the Excel file containing the parsed data.

### 🔌 Automate with Zapier & Make

No code needed — trigger this Actor from your existing tools.

- **Zapier**: search for the "Apify" app → action **Run Actor** → select `akula.marketing/telegram-get-chat-messages-channel-comments` → since this Actor delivers results via `webhookUrl`, point that field at your Zapier "Catch Hook" URL, then continue the Zap with the parsed message data. [Docs](https://docs.apify.com/platform/integrations/zapier)
- **Make**: add the **Apify → Run an Actor** module (async), and separately add a **Custom Webhook** trigger module using this Actor's `webhookUrl` field so the scenario continues once the export finishes. [Docs](https://docs.apify.com/platform/integrations/make)

Example: scenario runs this Actor on a target channel → webhook fires when the Excel export is ready → new messages get posted into a Slack channel for monitoring.

#### Support

Support 24/7 - [@KoteamSupport](https://t.me/KoteamSupport).
We also offer specialized solutions for Telegram-related tasks — contact us to learn more

⭐ Found this useful? [Leave a review](https://apify.com/akula.marketing/telegram-get-channel-messages-comments#reviews) — it helps others find this Actor and tells us what to build next.

🏷️ Find This Tool When You Search For
"telegram channel message scraper" - Archive posts and comments from any public channel
"telegram chat history export" - Download full message history to Excel
"telegram group message scraper" - Collect messages and their authors from chats
"telegram comment scraper" - Extract channel comments with author profiles
"telegram conversation analysis tool" - Analyze message activity and authorship
"telegram content archiving" - Preserve channel posts and discussion history
"telegram message export api" - Automate message collection via webhook
"telegram engagement research" - Study posting activity and audience behavior
"telegram osint" - Open source intelligence from Telegram data
"telegram investigation tool" - Professional intelligence gathering
🎯 Turn a channel's message history into structured, exportable data
🛡️ Track conversations and authorship for research and compliance
💰 Mine channel discussions for leads and market signals

# Actor input Schema

## `username` (type: `string`):

Channel username to get participants

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

URL to receive webhook notifications for parsing task updates

## `max_message_id` (type: `integer`):

Offset message ID (only messages previous to the given ID will be retrieved). Exclusive.

## `min_message_id` (type: `integer`):

All the messages with a lower (older) ID or equal to this will be excluded.

## `keep_duplicates` (type: `boolean`):

Whether to keep duplicate participants in the results

## Actor input object example

```json
{
  "username": "devs",
  "webhookUrl": "https://webhook.site/6fc27cda-2109-4dff-b4f7-b85cc33825ac",
  "keep_duplicates": false
}
```

# Actor output Schema

## `taskStatus` (type: `string`):

Whether the messages export task was created successfully. Messages and comments are delivered to your webhook URL.

# 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 = {
    "username": "devs",
    "webhookUrl": "https://webhook.site/6fc27cda-2109-4dff-b4f7-b85cc33825ac"
};

// Run the Actor and wait for it to finish
const run = await client.actor("akula.marketing/telegram-get-chat-messages-channel-comments").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 = {
    "username": "devs",
    "webhookUrl": "https://webhook.site/6fc27cda-2109-4dff-b4f7-b85cc33825ac",
}

# Run the Actor and wait for it to finish
run = client.actor("akula.marketing/telegram-get-chat-messages-channel-comments").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 '{
  "username": "devs",
  "webhookUrl": "https://webhook.site/6fc27cda-2109-4dff-b4f7-b85cc33825ac"
}' |
apify call akula.marketing/telegram-get-chat-messages-channel-comments --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,akula.marketing/telegram-get-chat-messages-channel-comments"
        }
    }
}
```

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/jRnEf7yxffgTUgMSZ/builds/kMDQVLOZs9Biz6E7J/openapi.json
