RU Open Web

Type to search client APIs, Bot API methods, and guides.

Bots & Mini Apps — Migrating from Telegram Bot API
Bots & Mini Apps Migrating from Telegram Bot API

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:

SurfaceNative TheaverCompatibility Alias
Mini Apps globalwindow.Theaver.WebAppwindow.Telegram.WebApp
Mini App init headerX-Theaver-Init-DataX-Telegram-Init-Data
Webhook secret headerX-Theaver-Bot-Api-Secret-TokenX-Telegram-Bot-Api-Secret-Token
Payment currencyTHVXTR (mapped 1:1 to THV for Telegram Stars bots)
External sticker importPOST /api/stickers/import-packPOST /api/stickers/import-telegram
  • Chat IDs: Theaver uses non-sequential 30-bit Feistel IDs (100 000 000 – 2 147 483 647). Group and channel chat_id parameters accept raw IDs (849201432), -100849201432 prefixed IDs, and @username.
  • Parse modes: Supports MarkdownV2, Markdown, HTML, and explicit entities arrays.
  • Media files: Use getFile to obtain file_path and download over HTTPS from /file/bot<token>/<file_path>.