Migrating from Telegram Bot API
Run existing aiogram, grammY, python-telegram-bot, or telegraf bots and Telegram WebApps on Theaver with zero code rewrites.
Because Theaver implements the standard /bot<token>/<method> contract, response envelope ({"ok": true, "result": ...}), Update payload fields, Mini App v8 JS bridge aliases, and reply_markup types, existing Telegram bots and Mini Apps typically require only changing the API base URL to https://api.theaver.app.
Bot library examples
import asyncio
import os
from aiogram import Bot, Dispatcher, types
from aiogram.client.session.aiohttp import AiohttpSession
from aiogram.client.telegram import TelegramAPIServer
from aiogram.filters import CommandStart
session = AiohttpSession(
api=TelegramAPIServer.from_base("https://api.theaver.app")
)
bot = Bot(token=os.environ["BOT_TOKEN"], session=session)
dp = Dispatcher()
@dp.message(CommandStart())
async def on_start(message: types.Message):
await message.answer("Hello from Theaver Bot API.")
asyncio.run(dp.start_polling(bot))import { Bot, InlineKeyboard } from "grammy";
const bot = new Bot(process.env.BOT_TOKEN!, {
client: {
apiRoot: "https://api.theaver.app",
},
});
bot.command("start", async (ctx) => {
const kb = new InlineKeyboard().text("Confirm", "confirm_action");
await ctx.reply("Hello from Theaver Bot API.", { reply_markup: kb });
});
bot.start();import os
from telegram import Update
from telegram.ext import ApplicationBuilder, CommandHandler, ContextTypes
async def start(update: Update, context: ContextTypes.DEFAULT_TYPE):
await update.message.reply_text("Hello from Theaver.")
app = (
ApplicationBuilder()
.token(os.environ["BOT_TOKEN"])
.base_url("https://api.theaver.app/bot")
.base_file_url("https://api.theaver.app/file/bot")
.build()
)
app.add_handler(CommandHandler("start", start))
app.run_polling()const { Telegraf } = require("telegraf");
const bot = new Telegraf(process.env.BOT_TOKEN, {
telegram: {
apiRoot: "https://api.theaver.app",
},
});
bot.start((ctx) => ctx.reply("Hello from Theaver."));
bot.launch(); Consolidated compatibility aliases
Theaver keeps these drop-in compatibility shims alongside native Theaver naming:
| Surface | Native Theaver | Compatibility Alias |
|---|---|---|
| Mini Apps global | window.Theaver.WebApp | window.Telegram.WebApp |
| Mini App init header | X-Theaver-Init-Data | X-Telegram-Init-Data |
| Webhook secret header | X-Theaver-Bot-Api-Secret-Token | X-Telegram-Bot-Api-Secret-Token |
| Payment currency | THV | XTR (mapped 1:1 to THV for Telegram Stars bots) |
| External sticker import | POST /api/stickers/import-pack | POST /api/stickers/import-telegram |
- Chat IDs: Theaver uses non-sequential 30-bit Feistel IDs (
100 000 000–2 147 483 647). Group and channelchat_idparameters accept raw IDs (849201432),-100849201432prefixed IDs, and@username. - Parse modes: Supports
MarkdownV2,Markdown,HTML, and explicitentitiesarrays. - Media files: Use
getFileto obtainfile_pathand download over HTTPS from/file/bot<token>/<file_path>.