> ## Documentation Index
> Fetch the complete documentation index at: https://www.ayrshare.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Telegram API

> 使用 Telegram API 发布内容的选项

## 发布到 Telegram

使用 Telegram API 发布带有链接和图片的基本帖子的 JSON 示例：

```json Telegram Post theme={"system"}
{
  "post": "The best Telegram message ever #best https://www.telegram.com", // empty string is allowed
  "mediaUrls": ["https://img.ayrshare.com/012/gb.jpg"],
  "platforms": ["telegram"]
}
```

除非帖子中包含图片或视频，否则 Telegram 会自动在频道或群组中预览链接。在上面的示例中会显示图片。移除图片后，链接预览将会显示。

如果你的视频不是以已知的视频扩展名（如 mp4）结尾，请使用 `isVideo` 参数。详情请参见 [/post 端点](/apis/post/post)。

更多信息请参见 [Telegram 媒体指南](/media-guidelines/telegram) 和 [Telegram 授权](/dashboard/connect-social-accounts/telegram)。

## 动态 GIF

Telegram 动态 GIF 只允许一个 URL。如果媒体 URL 不以 ".gif" 或 ".GIF" 结尾，请将 `isVideo` 字段设置为 `true`。

```json Telegram Animated GIF theme={"system"}
{
    "randomPost": true,
    "platforms": [
        "telegram"
    ],
    "isVideo": true,    // Set to true if the mediaURL does not end in .gif or .GIF
    "mediaUrls": ["https://img.ayrshare.com/012/cat.gif"]
}
```

## Telegram 提及

通过在帖子文本中添加 `@handle` 来提及其他 Telegram 用户。例如：

```json Telegram Post with Mention theme={"system"}
{
  "post": "The best Telegram image post ever @handle",
  "platforms": ["telegram"]
}
```

<Warning>
  请查看提及功能的[重要规则](/testing/post-verification#mentions)。
</Warning>

## 字符限制

更多信息请参见 [Telegram 字符限制](/help-center/technical-support/character_limits#telegram-character-limits)。
