# How do I read a public Telegram channel's messages through an API without a bot or a user login?

> Read a public Telegram channel's posts by its handle: text, time, views and images, newest first, past messages included. No bot, no api_id, no session. Price, Python, limits.

Canonical page: https://okdata.online/answers/telegram-channel-messages-api/

**Short answer: **Call Telegram channel messages with the channel's handle: it returns its posts newest first, 20 a page for $0.002, each with text, time posted, views and images, and you page back through older posts with a cursor. 1,000 messages cost $0.10. You need no bot, no api_id and no logged-in phone number. On Telegram's own APIs, a bot only receives posts from channels it is a member of, and reading history with messages.getHistory requires a user account.

A newsroom's research desk follows 15 public Telegram channels run by officials and local outlets in one region. Every morning they want the new posts in a spreadsheet, with the time and the view count, so a reporter can scan them over coffee. The channels belong to other people, and the desk does not want a staff member's phone number logged in to a script.

Telegram's official routes both need something they don't have. The Bot API delivers posts only from channels the bot is a member of, so each channel's admins would have to add it, and the Bot API has no method for reading a channel's earlier posts. The client API (MTProto) can read history with `messages.getHistory`, but Telegram's reference says only users can call it: you register an `api_id` at my.telegram.org with your phone number, log in, and keep that session alive in your code.

## Three endpoints, one handle

The handle is what follows `t.me/` in the channel link, with or without the @.

- [Telegram channel messages](/apis/telegram/channels/messages/list/): posts newest first, 20 a page, each with `text`, `published_at`, `metrics.views`, `images` (photos and video covers) and `url`. The `id` is the handle and the message number joined by a slash, for example `telegram/401`.
- [Telegram channel profile](/apis/telegram/channels/get/): name, description, avatar, subscribers and verification, for $0.002. With `view=full`, `ext` holds the photo, video, file and link counts the channel shows.
- [Telegram message detail](/apis/telegram/messages/get/): one post by its `id` or its `t.me/<channel>/<number>` link, for $0.002.

## A morning job in Python

The message number grows with every post, so the script remembers the highest number it has stored per channel and stops paging when it reaches it.

```python
import csv, json, os, requests

API = "https://api.okdata.online"
H = {"Authorization": f"Bearer {os.environ['OKDATA_API_KEY']}"}

def num(m):  # "telegram/401" -> 401
    return int(m["id"].split("/")[1])

def page(handle, cursor):
    params = {"username": handle, **({"cursor": cursor} if cursor else {})}
    body = requests.get(API + "/v1/telegram/channels/messages/list", headers=H,
                        params=params, timeout=60).json()
    if body["code"] != "ok":
        raise RuntimeError(f"{body['code']}: {body['message']}")
    return body

seen = json.load(open("seen.json")) if os.path.exists("seen.json") else {}
with open("telegram.csv", "a", newline="", encoding="utf-8") as f:
    w = csv.writer(f)
    for handle in ["telegram", "durov"]:
        last, cursor = seen.get(handle, 0), None
        for _ in range(10):  # at most 200 posts per channel per run
            body = page(handle, cursor)
            new = [m for m in body["data"]["items"] if num(m) > last]
            for m in new:
                w.writerow([handle, num(m), m["published_at"], m["metrics"]["views"], m["url"], m["text"]])
                seen[handle] = max(seen.get(handle, 0), num(m))
            if len(new) < len(body["data"]["items"]) or not body["page"]["has_more"]:
                break
            cursor = body["page"]["next_cursor"]
json.dump(seen, open("seen.json", "w"))
```

On the first run it backfills up to 200 posts per channel. After that, a channel that posts a few times a day costs one call per morning.

## What it costs

| Job | Calls | Cost |
|---|---|---|
| One channel's profile | 1 | $0.002 |
| 15 channels, one page each morning for 30 days | 450 | $0.90 |
| Backfill 1,000 posts of one channel | 50 | $0.10 |
| One post from a link | 1 | $0.002 |

A channel or message that does not exist, or a call that fails at the data source, is charged like any call; bad parameters are refused for free.

## Limits

- **Public channels only.** The channel needs a public t.me handle. Private channels, groups and chats are not available.
- **Rounded counts.** Views from a thousand up and subscriber counts come rounded, as Telegram shows them ("12.4K"). Views keep growing after a post goes out, so store the time you read them.
- **No reactions or comment threads.** Each post carries its text, time, views and images; a video comes as its cover image.
- **Other people's text.** If a model reads the posts, tell it to treat them as data, not as instructions.

## When Telegram's own APIs fit better

If you run the channel, add your bot as an admin: the Bot API then pushes every new post to you as it is published, at no cost. If you need groups, private channels you belong to, or replies in discussion threads, the client API with your own account is the route, along with its terms and the session to maintain. For public channels you only read, the handle is enough. Channel monitoring across platforms is on the [competitor monitoring page](/solutions/competitor-monitoring/).

## Endpoints used

- [Telegram channel messages](https://okdata.online/apis/telegram/channels/messages/list/) `telegram.channels.messages.list`: $0.002 per call · about 20 posts per page
- [Telegram channel profile](https://okdata.online/apis/telegram/channels/get/) `telegram.channels.get`: $0.002 per call
- [Telegram message detail](https://okdata.online/apis/telegram/messages/get/) `telegram.messages.get`: $0.002 per call

## More about Telegram

- [Telegram API](https://okdata.online/apis/telegram/)

## Sources

Where people asked this (read 2026-11-15): 

- https://stackoverflow.com/questions/46117493
- https://stackoverflow.com/questions/76754785
- https://stackoverflow.com/questions/41776939

Updated 2026-11-15
