# Scrape Telegram Posts In A Date Range

**Use case:** 

Two date bounds make a window. Messages published on or after the first date and before the second are kept, and the walk still stops once a whole page falls outside the window.

## Input

```json
{
  "channels": [
    "telegram",
    "durov",
    "telegramtips",
    "producthunt",
    "javascript"
  ],
  "mode": "posts",
  "searchTerms": [],
  "maxPostsPerChannel": 500,
  "maxScannedPerChannel": 2000,
  "maxItems": 2000,
  "postedAfter": "2026-01-01",
  "postedBefore": "",
  "lastNDays": 0,
  "mustContain": [],
  "mustNotContain": [],
  "mediaTypes": [],
  "minViews": 0,
  "maxViews": 0,
  "minReactions": 0,
  "skipServiceMessages": true,
  "skipForwarded": false,
  "onlyNewPosts": false,
  "includeChannelCard": true,
  "includeTextHtml": false,
  "compact": false,
  "inputDatasetId": "",
  "channelField": "channel_username"
}
```

## Output

```json
{
  "channel_username": {
    "label": "Channel @name",
    "format": "string"
  },
  "channel_title": {
    "label": "Channel title",
    "format": "string"
  },
  "post_id": {
    "label": "Message id",
    "format": "integer"
  },
  "date": {
    "label": "Posted at",
    "format": "string"
  },
  "text": {
    "label": "Message text",
    "format": "string"
  },
  "url": {
    "label": "Message URL",
    "format": "string"
  },
  "views": {
    "label": "Views",
    "format": "integer"
  },
  "reactions_total": {
    "label": "Reactions total",
    "format": "integer"
  },
  "reactions": {
    "label": "Reactions",
    "format": "array"
  },
  "media_types": {
    "label": "Attachment types",
    "format": "array"
  },
  "photo_url": {
    "label": "Photo",
    "format": "string"
  },
  "video_url": {
    "label": "First video",
    "format": "string"
  },
  "link_preview_url": {
    "label": "Link preview URL",
    "format": "string"
  },
  "link_preview_title": {
    "label": "Link preview title",
    "format": "string"
  },
  "poll_question": {
    "label": "Poll question",
    "format": "string"
  },
  "poll_voters": {
    "label": "Poll voters",
    "format": "integer"
  },
  "forwarded_from_name": {
    "label": "Forwarded from",
    "format": "string"
  },
  "reply_to_url": {
    "label": "Reply to URL",
    "format": "string"
  },
  "author_signature": {
    "label": "Author signature",
    "format": "string"
  },
  "via_bot": {
    "label": "Sent via bot",
    "format": "string"
  },
  "hashtags": {
    "label": "Hashtags",
    "format": "array"
  },
  "mentions": {
    "label": "Mentions",
    "format": "array"
  },
  "links": {
    "label": "Links in text",
    "format": "array"
  },
  "channel_subscribers": {
    "label": "Subscribers",
    "format": "integer"
  },
  "channel_id": {
    "label": "Channel numeric id",
    "format": "integer"
  },
  "action_label": {
    "label": "Action label",
    "format": "string"
  },
  "channel_description": {
    "label": "Channel description",
    "format": "string"
  },
  "channel_files_count": {
    "label": "Channel files",
    "format": "integer"
  },
  "channel_is_verified": {
    "label": "Channel verified",
    "format": "boolean"
  },
  "channel_links_count": {
    "label": "Channel links",
    "format": "integer"
  },
  "channel_photo_url": {
    "label": "Channel photo",
    "format": "string"
  },
  "channel_photos_count": {
    "label": "Channel photos",
    "format": "integer"
  },
  "channel_subscribers_text": {
    "label": "Subscribers as shown",
    "format": "string"
  },
  "channel_url": {
    "label": "Channel URL",
    "format": "string"
  },
  "channel_videos_count": {
    "label": "Channel videos",
    "format": "integer"
  },
  "counter_text": {
    "label": "Counter as shown",
    "format": "string"
  },
  "description": {
    "label": "Description",
    "format": "string"
  },
  "document_extra": {
    "label": "File detail",
    "format": "string"
  },
  "document_kind": {
    "label": "File kind",
    "format": "string"
  },
  "document_title": {
    "label": "File name",
    "format": "string"
  },
  "entity_type": {
    "label": "Entity type",
    "format": "string"
  },
  "files_count": {
    "label": "Files",
    "format": "integer"
  },
  "forwarded_from_url": {
    "label": "Forwarded from URL",
    "format": "string"
  },
  "found": {
    "label": "Found",
    "format": "boolean"
  },
  "found_via": {
    "label": "Found via",
    "format": "string"
  },
  "handle": {
    "label": "Handle",
    "format": "string"
  },
  "has_poll": {
    "label": "Has poll",
    "format": "boolean"
  },
  "has_public_preview": {
    "label": "Has public preview",
    "format": "boolean"
  },
  "inline_buttons": {
    "label": "Buttons",
    "format": "array"
  },
  "is_album": {
    "label": "Album",
    "format": "boolean"
  },
  "is_forwarded": {
    "label": "Forwarded",
    "format": "boolean"
  },
  "is_reply": {
    "label": "Reply",
    "format": "boolean"
  },
  "is_service_message": {
    "label": "Service message",
    "format": "boolean"
  },
  "is_verified": {
    "label": "Verified",
    "format": "boolean"
  },
  "latest_post_id": {
    "label": "Latest message id",
    "format": "integer"
  },
  "link_preview_description": {
    "label": "Link preview text",
    "format": "string"
  },
  "link_preview_image_url": {
    "label": "Link preview image",
    "format": "string"
  },
  "link_preview_site": {
    "label": "Link preview site",
    "format": "string"
  },
  "links_count": {
    "label": "Links",
    "format": "integer"
  },
  "media_count": {
    "label": "Attachments",
    "format": "integer"
  },
  "members": {
    "label": "Members",
    "format": "integer"
  },
  "online": {
    "label": "Online",
    "format": "integer"
  },
  "photos": {
    "label": "Photos",
    "format": "array"
  },
  "photos_count": {
    "label": "Photos",
    "format": "integer"
  },
  "poll_options": {
    "label": "Poll options",
    "format": "array"
  },
  "poll_options_count": {
    "label": "Poll options count",
    "format": "integer"
  },
  "poll_type": {
    "label": "Poll type",
    "format": "string"
  },
  "poll_voters_text": {
    "label": "Poll voters as shown",
    "format": "string"
  },
  "post_key": {
    "label": "Channel/message",
    "format": "string"
  },
  "reaction_types": {
    "label": "Distinct reactions",
    "format": "integer"
  },
  "reply_to_author": {
    "label": "Reply to author",
    "format": "string"
  },
  "reply_to_text": {
    "label": "Reply to text",
    "format": "string"
  },
  "scraped_at": {
    "label": "Scraped at",
    "format": "string"
  },
  "sticker_url": {
    "label": "Sticker",
    "format": "string"
  },
  "subscribers": {
    "label": "Subscribers",
    "format": "integer"
  },
  "text_html": {
    "label": "Message HTML",
    "format": "string"
  },
  "text_length": {
    "label": "Text length",
    "format": "integer"
  },
  "timestamp": {
    "label": "Posted at (epoch)",
    "format": "integer"
  },
  "title": {
    "label": "Title",
    "format": "string"
  },
  "type": {
    "label": "Row type",
    "format": "string"
  },
  "video_duration_seconds": {
    "label": "Video seconds",
    "format": "integer"
  },
  "videos": {
    "label": "Videos",
    "format": "array"
  },
  "videos_count": {
    "label": "Videos",
    "format": "integer"
  },
  "views_text": {
    "label": "Views as shown",
    "format": "string"
  },
  "voice_duration_seconds": {
    "label": "Voice seconds",
    "format": "integer"
  },
  "voice_url": {
    "label": "Voice message",
    "format": "string"
  }
}
```

## How it works

### 1. Sign up on Apify or log in

The Telegram Keyword Search Scraper - Channel Posts, Messages Actor is ready to run with the inputs already set for "Scrape Telegram Posts In A Date Range". [Sign up or log in](https://console.apify.com/create-task-from-example/MU6baMuhT8iUa6xfx) and you'll land in Apify Console with a copy of this exact task.

### 2. Start the "Scrape Telegram Posts In A Date Range" task

The Telegram Keyword Search Scraper - Channel Posts, Messages Actor will start running based on the input automatically. You can also change all the input fields, like 📣 channels, 🎛 what to collect, and more, to match your specific use case.

### 3. Receive the "Scrape Telegram Posts In A Date Range" output

Monitor the progress in real time. You will be notified as soon as your dataset is complete and ready for review. Each result includes data such as channel @name, channel title, message id, and more.

### 4. Integrate into your workflow

The final output is delivered in JSON, CSV, or Excel format, ready to be plugged into your workflow. You can also [run the "Scrape Telegram Posts In A Date Range" task via API](https://apify.com/snow_leo_data/telegram-channel-scraper.md).

## About this Actor

This example demonstrates how to use [Telegram Keyword Search Scraper - Channel Posts, Messages](https://apify.com/snow_leo_data/telegram-channel-scraper.md) with a specific input configuration. Visit the [Actor detail page](https://apify.com/snow_leo_data/telegram-channel-scraper.md) to learn more, explore other use cases, and run it yourself.


## How to integrate an Actor?

This Task's input is already configured above. Use it as-is rather than inventing a new one.

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 full API examples (JavaScript, Python, CLI, MCP, OpenAPI), see this Task's Actor page: https://apify.com/snow_leo_data/telegram-channel-scraper.md

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`).
