# Telegram 频道帖子 API (telegram.channel_posts)

- Canonical page: [https://everyinfra.com/telegram-api/channel_posts](https://everyinfra.com/telegram-api/channel_posts?utm_medium=ai_doc&utm_campaign=page_md)
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "telegram", "action": "channel_posts", "params": {...}}
- Price: $0.000556 per call ($0.56 per 1,000 requests); failed calls and empty results are not charged
- Returns: list, default 20, max 200 per call
- Mode: sync; add "mode": "async" for slow tasks

Telegram 频道帖子按 `username` 读一个公开频道的帖子，一次返回一个列表：频道名称 `channel_title`、正文、浏览数、发布时间、媒体类型和链接、发送者、是否转发、转发来源和表情回应。它回答「这个频道在发什么、哪些帖子被看得多」，适合监测频道动向、追踪话题传播和做舆情抽样。

内容详情那一页也收 t.me 链接，但带了消息编号也只取频道名，不会按编号读单条消息，返回的只是单个对象，也没有频道名称字段。

## Health

- Live health (24h percent, hourly and daily trends): https://api.everyinfra.com/api/v1/social/availability?platform=telegram&action=channel_posts

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| username | not declared | yes | not declared | 公开频道或群的用户名，可为 name、@name、t.me/name 或 t.me/s/name。channel_posts/profile 用于公开频道，group 读取公开实体信息，members 读取可见群成员；不支持私密邀请链接，也不承诺完整成员名单。 |
| limit | integer (1–200) | no | 20 | 这次调用最多返回的条数，整数，1–200；不传按默认值，实际返回可能少于这个数。超过上限会在扣费前返回 422。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| id | 该记录在原平台上的唯一标识。仅在同一平台内唯一，跨平台可能重复。 |
| url | 该记录在原平台上的可访问链接。 |
| channel_username | 频道用户名（@开头的公开标识）。 |
| channel_title | 频道名称。 |
| text | 正文内容，已去除 HTML 标签，全文返回、不截断（个别平台的列表结果本身只有摘要，以该平台的字段说明为准）。 |
| view_count | 浏览/播放数。null 表示不公开，不等于 0。 |
| posted_at | 发布时间，ISO 8601 格式、UTC 时区（如 2026-08-07T12:34:56+00:00）。平台只给非标准字符串时原样透传，解析前建议做容错。null 表示平台未公开。 |
| media_type | 媒体类型（照片/视频/文件/语音）。 |
| media_url | 媒体文件链接。 |
| author | 消息发送者。 |
| is_forwarded | 该消息是否为转发。 |
| forwarded_from | 转发来源。追溯信息传播链用。 |
| reply_to_url | 被回复消息的链接。 |
| platform | 数据来源平台标识，与请求里的 platform 一致（如 xiaohongshu、tiktok）。 |
| link_preview_url | platform-native meaning |
| reactions | 表情回应及各自数量。 |

## Example

```bash
curl -X POST 'https://api.everyinfra.com/api/v1/social' \
  -H "Authorization: Bearer $EVERYINFRA_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "platform": "telegram",
  "action": "channel_posts",
  "params": {
    "username": "<PUBLIC_CHANNEL_USERNAME>"
  }
}'
```

```python
import os
import requests

response = requests.post(
    "https://api.everyinfra.com/api/v1/social",
    headers={"Authorization": f"Bearer {os.environ['EVERYINFRA_API_KEY']}"},
    json={
        "platform": "telegram",
        "action": "channel_posts",
        "params": {
            "username": "<PUBLIC_CHANNEL_USERNAME>",
        },
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

No real sample for these example parameters yet: structure only, every value is a placeholder (…).

```text
{
  "id": "req_…",
  "platform": "telegram",
  "action": "channel_posts",
  "results": [
    {
      "id": …,
      "url": …,
      "channel_username": …,
      "channel_title": …,
      "text": …,
      "view_count": …,
      "posted_at": …,
      "media_type": …,
      "media_url": …,
      "author": …,
      "is_forwarded": …,
      "forwarded_from": …,
      "reply_to_url": …,
      "platform": …,
      "link_preview_url": …,
      "reactions": …
    }
  ],
  "count": …,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## FAQ

### `username` 能填哪些写法？

公开频道的用户名都行：name、@name、t.me/name 和 t.me/s/name 四种写法等价。私密邀请链接和单条消息的编号不是这个参数的合法输入，示例里的占位符要换成真实的公开频道用户名。

### 转发和回复的帖子怎么识别？

`is_forwarded` 为真表示这条是转发，`forwarded_from` 给出转发来源，追溯信息传播链时要用它。`reply_to_url` 是被回复消息的链接，可以顺着它把回复串起来。

### 浏览数和表情回应怎么读？

`view_count` 为 null 表示不公开，不等于 0；`reactions` 是表情回应和各自的数量。帖子带媒体时，`media_type` 区分照片、视频、文件和语音，`media_url` 是媒体文件的链接。

## Also

- Capability catalog (no key): https://api.everyinfra.com/api/v1/social/catalog?platform=telegram
- OpenAPI: https://everyinfra.com/openapi.json · Agents guide: https://everyinfra.com/agents.md
