Telegram bot hosting

Host a Telegram bot: long polling or webhooks, from $1.50 a month

You can host a Telegram bot on Makofy for $3.50 a month as an always-on long-polling worker, or for $1.50 a month as a webhook bot on the Nap type, which sleeps after 15 idle minutes and wakes in about 2 to 6 seconds when Telegram delivers the next update. Both work with Python, Node.js, Go or any Dockerfile, with the bot token kept in an environment variable.

Last updated · By the Makofy team (Muncar Ventures LLC)

Long polling or webhook: which one to choose

Telegram offers two ways to receive updates, and they map onto two different Makofy service types.

Makofy prices in USD per app per month. Telegram only delivers webhooks over HTTPS; every Makofy web service has an HTTPS URL.
Long pollingWebhook
How updates arriveThe bot asks Telegram for new updates in a loop (getUpdates)Telegram sends each update as an HTTPS POST to your URL
Makofy service typeBackground worker (no port)Web service with an HTTPS URL
Cheapest instance typeStarter, $3.50/mo (always on)Nap, $1.50/mo (sleeps when idle)
Reply after a quiet spellImmediateFirst update waits about 2–6 s while the app wakes
SetupToken onlyToken plus setWebhook with your app’s URL
Best forBots that also send messages on their own scheduleCommand bots used in bursts

Long polling is the simplest setup: no URL, no certificate and no webhook registration. A webhook costs less on Makofy because a web service may sleep. While it sleeps, the Makofy gateway holds Telegram’s request (for up to 45 seconds) and passes it on as soon as the app is up, so the update arrives a few seconds late rather than being dropped. If your bot sends reminders or alerts by itself, it has to stay awake, so use Starter in either mode.

Deploy a long-polling bot with python-telegram-bot

  1. Create the bot with @BotFather in Telegram and copy the token it gives you.
  2. Add python-telegram-bot to requirements.txt and save the code below as app.py. Makofy builds Python projects on Python 3.12 and starts a plain script like this one with python app.py.
  3. Install the CLI (curl -fsSL https://makofy.com/install.sh | sh), run makofy login, then makofy deploy --type worker from the project folder.
  4. In the dashboard, set TELEGRAM_TOKEN and deploy again: environment variables are applied at deploy time.
  5. Send /start to your bot. If it stays silent, makofy logs shows the build log and the latest lines from the running bot.
import os

from telegram import Update
from telegram.ext import Application, CommandHandler, ContextTypes


async def start(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
    await update.message.reply_text("Hi! I'm running on Makofy.")


def main() -> None:
    app = Application.builder().token(os.environ["TELEGRAM_TOKEN"]).build()
    app.add_handler(CommandHandler("start", start))
    app.run_polling()  # long polling: no port, no URL


if __name__ == "__main__":
    main()

Deploy a webhook bot on the $1.50 Nap type

In webhook mode the bot is a web service. It has to listen on the port in the PORT environment variable (Makofy sets it, 8080 by default) and tell Telegram its public URL. python-telegram-bot does both in run_webhook; install it as python-telegram-bot[webhooks].

def main() -> None:
    app = Application.builder().token(os.environ["TELEGRAM_TOKEN"]).build()
    app.add_handler(CommandHandler("start", start))
    app.run_webhook(
        listen="0.0.0.0",
        port=int(os.environ.get("PORT", "8080")),
        url_path="telegram",
        webhook_url=os.environ["PUBLIC_URL"] + "/telegram",
        secret_token=os.environ["WEBHOOK_SECRET"],  # Telegram echoes it in a header
    )
  1. Deploy with makofy deploy (web is the default type). The CLI prints the app’s URL, https://<app>--<workspace>.makofy.sh.
  2. Set TELEGRAM_TOKEN, PUBLIC_URL (that URL) and a long random WEBHOOK_SECRET, then deploy again. On start-up the bot calls setWebhook, and requests without the secret header are rejected.
  3. In the app’s settings, switch the instance type to Nap to pay $1.50 a month instead of $3.50.
  4. Optionally attach your own domain; see custom domains. Update PUBLIC_URL and redeploy if you do.

What common Telegram bot setups cost

USD per month; 7-day free trial, card required. Postgres and Redis are per workspace and shared by its apps.
BotWhat runs on MakofyMonthly cost
Command bot, webhookNap web service$1.50
Command bot, long pollingStarter worker$3.50
Bot that stores users or subscriptionsStarter worker + Postgres$6.50
Reminder bot with a job queueStarter worker + Redis$5.50
Two bots sharing one database2 × Starter + Postgres$10

Elsewhere, an always-on 512 MB instance was $7 a month on Render and as a Heroku Basic dyno, about $3.69 on Fly.io and $5 plus usage on Railway when we checked in November 2026. Render’s free tier sleeps and takes about a minute to wake, long enough for users to think the bot is broken. Makofy’s Nap is the middle ground: $1.50, with a wake-up measured in seconds.

Running a Telegram bot reliably

  • One consumer per token. Run a single instance of a polling bot: a second copy using the same token gets a 409 Conflict from Telegram, and polling doesn’t work while a webhook is set.
  • Secrets. Keep the token in an environment variable or a shared env group, never in the code or the repository.
  • Crashes and bad deploys. A crashed process is started again. If a new version fails while deploying, Makofy restores the previous working version automatically, and one-click rollback in the dashboard covers the rest.
  • State. Telegram doesn’t store your bot’s data. Keep users and settings in Postgres ($3/mo) rather than local files, which don’t survive a redeploy.
  • Other languages. Telegraf and grammY bots on Node.js deploy the same way (Makofy runs npm start on Node 20); see deploying Node.js.

FAQ

Frequently asked questions

How much does Telegram bot hosting cost on Makofy?

$1.50 a month for a webhook bot on Nap, or $3.50 a month for an always-on long-polling bot on Starter. There is a 7-day free trial; a card is required.

Should my Telegram bot use long polling or a webhook?

Use long polling for the simplest setup or if the bot sends messages on its own. Use a webhook on Nap for the lowest price if a few seconds’ delay on the first message after 15 idle minutes is acceptable.

Do I need HTTPS for a Telegram webhook?

Yes, Telegram only delivers webhooks over HTTPS, and every Makofy web service gets an HTTPS URL at https://<app>--<workspace>.makofy.sh automatically.

Will my bot miss messages while it sleeps on Nap?

Normally not: the gateway holds Telegram’s request while the app wakes, which typically takes 2 to 6 seconds, and Telegram retries deliveries that fail.

Can I host a Telegram bot written in Node.js or Go?

Yes. Makofy auto-detects Node.js and Go projects, and any other language works with a Dockerfile.

Related

Deploy your app in a few minutes.

Connect a GitHub repo or run makofy deploy. Flat price per app, 7-day free trial, card required.

Start free trial