TeleNest Bot API
TeleNest bots speak the Telegram Bot API. Same methods, same JSON, same
{"ok": true, "result": ...} answers. Most Telegram bots run on TeleNest by changing
one line: the API address.
1. Make a bot
In the app: Settings โ My bots โ New bot. Pick a name and a username ending in bot
(e.g. WeatherBot). You get a token like 1000042:Xy3.... Keep it secret: anyone with it
controls the bot. You can reset it any time (the old one stops working).
2. Point your code at TeleNest
Your server: https://<your API address> (test server:
http://api-c82jwesqbkm4dawolggxjthb.72.61.228.213.sslip.io).
python-telegram-bot (v20+)
app = (Application.builder().token(TOKEN)
.base_url("https://API_ADDRESS/bot")
.base_file_url("https://API_ADDRESS/file/bot")
.build())
aiogram 3
from aiogram.client.session.aiohttp import AiohttpSession
from aiogram.client.telegram import TelegramAPIServer
bot = Bot(TOKEN, session=AiohttpSession(api=TelegramAPIServer.from_base("https://API_ADDRESS")))
Plain HTTP
POST https://API_ADDRESS/bot<TOKEN>/sendMessage
{"chat_id": 1000001, "text": "Hello"}
Both libraries above were tested end to end (commands, buttons, callback answers, editing, photos, getFile downloads, polling).
Updates
- Long polling:
getUpdateswithoffsetandtimeout(up to 50 s). - Webhooks:
setWebhookwith anhttps://URL and optionalsecret_token(sent asX-Telegram-Bot-Api-Secret-Token). Failed deliveries are retried with back-off; seegetWebhookInfo. Webhooks can't point at private/internal addresses. Undelivered updates are kept for 24 hours. - Update types:
message,edited_message,channel_post,edited_channel_post,callback_query.
IDs
- Private chats:
chat.idis the person's user id, like Telegram.send_message(user_id, ...)works once that person has started the bot (a bot can't message someone first). - Groups and channels:
chat.idis the chat id. Channels also accept"@channelname". message_idcounts up per chat.file_idis the TeleNest media id.
Groups
Add the bot like any member. Privacy mode (on by default) means the bot only sees
/commands (and /command@YourBot) and replies to its own messages. Turn it off in
My bots to see every message. To post in a channel, make the bot an admin there.
Methods
| Works | Methods |
|---|---|
| Basics | getMe, logOut, close |
| Updates | getUpdates, setWebhook, deleteWebhook, getWebhookInfo |
| Sending | sendMessage, sendPhoto, sendVideo, sendAnimation (as video), sendVoice, sendAudio (as file), sendDocument, forwardMessage, copyMessage, sendChatAction |
| Editing | editMessageText, editMessageCaption, editMessageReplyMarkup, deleteMessage |
| Buttons | inline keyboards (callback_data and url buttons), answerCallbackQuery (text, show_alert) |
| Chats | getChat, getChatMember, getChatMemberCount, getChatAdministrators, leaveChat |
| Profile | setMyCommands, getMyCommands, deleteMyCommands, setMyDescription, getMyDescription, setMyName |
| Files | getFile, then download from /file/bot<TOKEN>/<file_path> |
Files can be sent as an upload (multipart), a file_id, or a public https:// URL.
Limits: photos 20 MB, videos and files 100 MB, voice 20 MB.
Not yet supported (planned)
Text formatting (parse_mode is accepted but the formatting is removed, words kept), reply
keyboards (only inline keyboards), inline mode, payments, polls, stickers, reactions,
answerInlineQuery, getUserProfilePhotos, games. Unknown methods return
404 Not Found: method not found.
Limits
30 messages per second per bot, 60 API calls per second per bot. Too many โ 429.