API hosting

Deploy a Flask Telegram bot on DenkOps

Telegram long-polling requires a process that is always making the next getUpdates call, the moment it stops, messages queue up unanswered. A serverless deploy can't hold that loop open between invocations, but a DenkOps slot runs your Flask app as a persistent process, so the bot's polling loop never has to restart.

import threading
import telebot
from flask import Flask

app = Flask(__name__)
bot = telebot.TeleBot("BOT_TOKEN")  # env var

@bot.message_handler(func=lambda m: True)
def reply(message):
    bot.reply_to(message, "Got it.")

threading.Thread(target=bot.infinity_polling, daemon=True).start()

@app.get("/health")
def health():
    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?

Yes. The bot's polling loop runs in a background thread inside your always-on slot, so it keeps calling getUpdates and replying around the clock.

Do I need a public webhook URL for a long-polling bot?

No. Long-polling only needs outbound HTTPS, which the slot's egress gateway already allows, you don't need to expose a webhook endpoint at all.

← Deploy AI agents · API hosting