Telegram Bot

Telegram Bot

Send Telegram messages, photos, albums, documents, audio, video, animations, stickers, contacts, venues, locations and polls from any AI agent via the Telegram Bot API. Bot-token auth. Outbound plus a lightweight read of recent updates (no long-polling).

7 天免费 · 无需信用卡 · EU 托管

问 Telegram 任何事

通过 AnythingMCP 对 Telegram Bot 试一个真实提示 — Claude 调用工具并返回答案。在你的消息上按 Enter 即可在 Cloud 安装。

在 Cloud 上安装 Telegram
Telegram Bot · 通过 MCP 实时
分享
Opus 4.7

Claude 是 AI,可能会出错。请核对回答。

2 分钟设置

  1. 1在 cloud.anythingmcp.com 开始免费试用。
  2. 2在连接器商店点击 Telegram Bot。提示时粘贴凭据。
  3. 3生成 MCP API 密钥,将 AI 客户端指向生成的 MCP URL。
立即安装 Telegram Bot

Telegram 指南

面向主流 AI 客户端的逐步设置。

配置 Telegram Bot

直接来自连接器定义:在哪里获取凭据、需要哪些权限,以及该适配器调用的是哪个 API。 由连接器作者以英文提供。

This connector uses the official Telegram Bot API (https://core.telegram.org/bots/api).

Setup:

  1. In Telegram, open chat with @BotFather → /newbot → pick a display name and a username ending in bot.
  2. BotFather replies with an HTTP API token like 123456789:ABCDEFghijklmnopqrstuvwxyz. Treat as a secret: anyone with it can send as your bot.
  3. Set TELEGRAM_BOT_TOKEN to the full token.

Authentication model (Telegram-specific): the bot token goes in the URL path, NOT in a header. The base URL is https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN} and every endpoint is appended as /methodName. The adapter substitutes the token via the {{TELEGRAM_BOT_TOKEN}} env-var template in baseUrl.

chat_id model: every Telegram chat (user, group, channel) has a numeric chat_id. For groups and channels the bot must be ADDED first; for users, the user must have sent a /start to the bot at least once (Telegram's privacy rule). Once you have a chat_id (extract it from getUpdates), pin it.

Channels: for public channels you can also pass @channelusername (with the @) instead of a numeric chat_id. Private channels REQUIRE the numeric ID, which always starts with -100.

Markdown vs HTML: messages support 3 parse modes: MarkdownV2 (current, escape special chars), HTML (<b>, <i>, <a href>), or no formatting. Telegram's MarkdownV2 requires escaping _ * [ ] ( ) ~ > # + - = | { } . !`; agents that don't escape will get 400 'can't parse entities'. The HTML mode is easier for agents to compose safely.

File send model: media tools (sendPhoto, sendDocument, sendAudio, etc.) accept the media as:

  • HTTPS URL (recommended on AnythingMCP): Telegram fetches it server-side. URL must be ≤ 5MB for photos, ≤ 20MB for documents via URL.
  • file_id: a string returned from a previous send (caching: reuse the same file_id to re-send the same content without re-uploading).
  • multipart binary: NOT supported by this connector in a single tool call. Pre-upload elsewhere and pass the resulting URL or file_id.

Albums: telegram_bot_send_album sends 2 to 10 photos and videos as one grouped message (or 2 to 10 documents, or 2 to 10 audio files). Put the caption on the first item. If Telegram answers failed to send message #N with the error message WEBPAGE_CURL_FAILED, it could not download item N: the URL must be public and point straight at the file, not at a web page.

getUpdates vs webhooks: this connector exposes telegram_get_updates (long-polling pull) for one-shot reading of recent inbound messages. For continuous inbound stream (chatbot), use Telegram's webhook (setWebhook) and host the receiver yourself, outside the MCP request/response model.

Rate limits: 30 messages/sec to different chats, 1 msg/sec to the same chat, 20 messages/minute to the same group. On 429, honor the retry_after in the response.

Out of scope: payments, inline mode, callback query answers (these usually require a long-running webhook), passport, game scores, sticker management.

Files the bot received: a message in telegram_bot_get_updates carries a file_id (photo[-1] is the largest size, or document, voice, video). telegram_bot_get_file turns it into a file_path, and telegram_bot_download_file fetches the file. An image comes back as an image the assistant can see, any other file as an attachment. A file_id only works with the bot that received the file, and the Bot API serves files up to 20 MB.

你的 AI 距离 Telegram Bot 仅两次点击。

安装连接器、粘贴凭据、向 AI 提问。7 天免费,无需信用卡。