> ## 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)。
