BF BotFoundry
BotFoundry / 8 Bot Blueprints / telegram-miniapp-webhook
BOTFOUNDRY TELEGRAM RUNBOOK • 2000MB TDLIB & PGBOUNCER POOL

BotFoundry Telegram Local Bot API (2,000 MB) & Mini-App Webhook Runbook

Telegram’s hosted api.telegram.org endpoint caps bot uploads at 50 MB and throttles concurrent media transfers. On BotFoundry, we size self-hosted C++ TDLib telegram-bot-api containers unlocking 2,000 MB local zero-copy file handling alongside Redis + PgBouncer Mini-App backends.

Inspect Hostinger Specs for TG-BOTAPI via BotFoundry → Compare Vultr Tiers via BotFoundry → Load Preset in BotFoundry RAM Sizer →

BotFoundry Deterministic vCPU, RAM & Guard Matrix (BP-07 // TG-BOTAPI)

Public rates retrieved 2026-11-12 from official vendor pricing pages cited below; promotional & renewal prices may change — always verify exact specs, term length, and renewal rates on the vendor’s official checkout page.

Concurrency Scale vCPU DDR5 RAM OS / Runtime /dev/shm & Watchdog Guard Public Tier Match (2026-11-12)
Webhook Bot (<50 req/s) 1–2 vCPU KVM 4 GB DDR5 Ubuntu 24.04 + Caddy TLS Secret-Token Header + UFW Hostinger KVM 1 ($4.99/mo)
Local TDLib API (2,000 MB Files) 2–4 vCPU NVMe 8 GB DDR5 Ubuntu 24.04 Docker 100GB NVMe + 24h Cron Purge Hostinger KVM 2 ($5.99/mo) / Vultr HF 8GB
High-Traffic Mini-App + DB Pool 4–8 vCPU KVM 16–32 GB DDR5 Ubuntu 24.04 + PgBouncer Redis JWT Cache + Pool=100 Hostinger KVM 4 / KVM 8
Static Mini-App React/Vite UI Managed LiteSpeed 2–4 GB Isolated HTTP/3 Edge Static Host Offloads Bot VPS CPU 100% ChemiCloud Starter ($2.95/mo)

BotFoundry Unattended Supervisor Snippet (BP-07 // TG-BOTAPI)

BotFoundry local C++ telegram-bot-api 2000MB upload volume cleanup and PgBouncer Redis architecture
BotFoundry local C++ telegram-bot-api 2000MB upload volume cleanup and PgBouncer Redis architecture
docker-compose.yml — BotFoundry Local C++ telegram-bot-api + Daily Temp-File Reaper
services:
  tg-local-api:
    image: aiogram/telegram-bot-api:latest
    restart: unless-stopped
    init: true
    environment:
      TELEGRAM_API_ID: "${TG_API_ID}"
      TELEGRAM_API_HASH: "${TG_API_HASH}"
      TELEGRAM_LOCAL: "1"
    volumes:
      - tg_cache:/var/lib/telegram-bot-api
    ports:
      - "127.0.0.1:8081:8081"
    deploy:
      resources:
        limits:
          memory: 4G
volumes:
  tg_cache:
  1. 1. Aligning VPS Region with Telegram DC2/DC4 (Europe) and DC5 (Singapore) on BotFoundry

    Telegram anchors its core webhook dispatcher and European user shards in Europe (DC2/DC4) while routing Southeast Asian accounts through Singapore (DC5). Selecting Frankfurt/London or Singapore minimizes TLS handshake round-trips.

  2. 2. Preventing TDLib Media Cache from Filling 100 GB NVMe Disks in BotFoundry Deployments

    Local telegram-bot-api writes every 500 MB–2,000 MB video transfer into /var/lib/telegram-bot-api. Schedule a systemd timer (`find /var/lib/docker/volumes/tg_cache -type f -mmin +360 -delete`) every 6 hours so temporary media never exhausts NVMe inodes.

  3. 3. Caching WebApp.initData HMAC Sessions in Redis for Viral Mini-Apps on BotFoundry

    Campaign traffic spikes send thousands of concurrent Mini-App requests; verify the HMAC-SHA256 initData signature once, issue a short-lived Redis session token, and front PostgreSQL 16 with PgBouncer transaction pooling.

BotFoundry Troubleshooting & Sizing FAQ (BP-07 // TG-BOTAPI)

Why does BotFoundry recommend switching Telegram bots from getUpdates polling to HTTPS webhooks?

Long-polling serializes update fetches and wastes idle sockets; terminating HTTPS on port 443 via Caddy with X-Telegram-Bot-Api-Secret-Token validation pushes updates concurrently to uvloop/Bun workers.

Can BotFoundry users offload Mini-App static HTML/JS bundles to ChemiCloud?

Yes — hosting static React/Vite Mini-App assets on a $2.95/mo ChemiCloud LiteSpeed plan leaves 100% of your Ubuntu KVM VPS memory and CPU dedicated to API and database workers.

Which inbound TCP ports does Telegram officially accept for webhooks?

Telegram dispatches HTTPS webhooks exclusively to ports 443, 80, 88, or 8443 backed by a trusted TLS certificate (such as automated Let’s Encrypt).

Related BotFoundry Unattended Sizing Blueprints

Hostinger (BP-07 BotFoundry) From $4.99/mo
Inspect Specs on BotFoundry →