Skip to main content
Telegram logo

Telegram Bot

Lets an agent operate a Telegram bot: poll incoming updates, send messages and photos.

What it can do​

MethodWhat it does
get_meName the bot (its @username) and the chat a message without chat_id goes to: the chat that last wrote to the bot, else the remembered one. Sends nothing.
get_updatesReceive incoming updates (messages, callback queries, etc.) via long polling or one-off request. On success, you MUST save last received update to long term memory. When use method, you MUST take last received update …
get_photoDownload a photo (or any file) by Telegram file_id from get_updates message.photo[], save as AgentFile, return agent_file (id, public_url).
send_messageSend a text message to a chat.
send_photoSend a photo to a chat. Use photo=agent_file_id (from generate_image) or photo=HTTPS URL / file_id.
send_voiceSend a voice message. Prefer voice_url (HTTPS), e.g. agent_file.public_url from a previous speech generation tool call. Use voice_base64 only when you already have raw audio bytes explicitly.

How to get credentials​

  1. Open @BotFather in Telegram.
  2. Send /newbot, pick a name and username.
  3. BotFather returns a Bot Token in the form 123456789:ABCdefGhIJKlmNoPQRstuVwxyZ. Copy it.
  4. Paste the token in FlyMyAI when setting up the MCP.
  5. Open your bot in Telegram and press Start (or send it any message), so it knows which chat to write to. In a group, add the bot and write in the group.

If you need the bot in a group, add it manually and disable privacy mode with /setprivacy in BotFather if it must read all messages.

Fields to fill in FlyMyAI​

FlyMyAI fieldWhere it comes from
Bot TokenBotFather's reply after /newbot

Troubleshooting​

  • Nothing was sent, "does not know which chat to write to" - nobody has written to the bot yet. Open it in Telegram, press Start, then try again, or pass chat_id. get_me shows which chat it will use.
  • 401 Unauthorized - token is wrong or the bot was deleted. Ask BotFather for /token on the bot.
  • Bot doesn't see group messages - disable privacy mode with /setprivacy in BotFather, then remove and re-add the bot.
We love our partners - FlyMy.AI builds with the best. Thanks, Telegram!