API hosting

Deploy a FastAPI Telegram bot on DenkOps

Telegram's webhook mode pushes updates to your endpoint the instant a user messages the bot, and it expects a fast 200 back or it will retry and eventually give up. On DenkOps the FastAPI process is always warm, so python-telegram-bot's webhook handler answers immediately instead of racing a cold start on the first message after idle time.

from fastapi import FastAPI, Request
from telegram import Update
from telegram.ext import Application

app = FastAPI()
tg = Application.builder().token("BOT_TOKEN").build()

@app.post("/webhook")
async def webhook(req: Request):
    data = await req.json()
    update = Update.de_json(data, tg.bot)
    await tg.process_update(update)
    return {"ok": True}

Deploy it: install the plugin, say "deploy on DenkOps", and get a live SSL URL.

Start on DenkOps →

FAQ

Can I run a Telegram bot 24/7 on DenkOps with FastAPI?

Yes. The slot stays warm around the clock, so the webhook handler responds to every incoming message instantly, even after long idle periods.

Do I need to re-register my Telegram webhook after each deploy?

No, your DenkOps subdomain stays the same across deploys, so setWebhook only needs to be called once.

← Deploy AI agents · API hosting