Free Hosting for a Telegram Bot on Cloudflare Workers: Limits

Run a Telegram bot for free on Cloudflare Workers: free plan limits, setup with Wrangler or the API, working with an AI assistant and common pitfalls.

Updated 27.11.2026 9 min read

Cloudflare gives every account a free tier of Workers: small programs that run on its network and answer HTTP requests. That is enough to host a Telegram bot that works through a webhook, with no VPS, no card for a server and no operating system to maintain. This guide shows what the free plan includes, which limits matter for a bot, how to deploy with Wrangler or through the API (including with an AI assistant that writes the code), and where the free plan stops being enough. Limits are as of 27 November 2026, from Cloudflare's own documentation.

The short answer

  • Yes, a Telegram bot can run on Cloudflare for free. The Workers Free plan allows 100,000 requests a day, with no charge for duration. The bot works by webhook: Telegram sends every update to the Worker as a request.
  • It is serverless, not a VPS. The code runs when a request comes in. That suits webhook bots, scheduled jobs and small APIs, and does not suit long polling, userbots or heavy computing.
  • Main limits on the Free plan: 100,000 requests a day, 10 ms of CPU time per invocation (waiting for the network does not count), 50 subrequests per request, 5 cron triggers per account.
  • Storage is free but small: KV gives 1 GB with 1,000 writes a day, D1 gives 5 GB in total with 100,000 rows written a day.
  • Deploy with Wrangler or with an API token. An AI assistant can write and deploy the bot if you give it a narrow token and keep the secrets out of the chat.
  • You do not need a domain for a bot. You do for a Mini App, and a domain on Cloudflare also unlocks custom addresses for a Worker.

What a "free server" means here

Job Fits a Worker Why
A bot with commands, menus and notifications on a webhook Yes Each update is one short request
Scheduled jobs: reminders, price checks, monitoring Yes Cron triggers; the Free plan allows 5 per account
A small API, a form handler, a link redirector Yes Same request model
A bot on long polling No A Worker is not a process that stays alive
A userbot or a session that must stay connected No The same reason
Video, large files, heavy computing No 10 ms of CPU time per invocation on Free

Limits that matter for a bot

Numbers from Cloudflare's documentation for the Workers Free plan on 27 November 2026; check the limits page before you build on them.

Resource Free plan What it means for a bot
Requests 100,000 a day, reset at midnight UTC One update is one request, so about 100,000 messages a day
CPU time 10 ms per invocation; waiting on fetch(), KV or a database is not counted Enough to parse an update and call the Bot API
Memory 128 MB Enough for a bot; not for large data in memory
Subrequests 50 per request Calls to Telegram, KV and D1 inside one update
Environment variables 64 per Worker, 5 KB each The token and the secret go here as secrets
Workers per account 100 One Worker per bot is plenty
Cron triggers 5 per account Reminders and checks
KV 100,000 reads and 1,000 writes a day, 1 GB State for a small bot; do not write on every message
D1 5 million rows read and 100,000 rows written a day, 5 GB in total, 500 MB per database A real database for a small bot
Workers AI 10,000 Neurons a day A small allowance for AI calls from the Worker

What happens at the limit: Cloudflare returns Error 1027 for requests over the daily cap until the counter resets, so the bot goes silent. There is no general limit on requests per second.

Set up a bot in about fifteen minutes

  1. Create the bot in BotFather with /newbot and keep the token private.
  2. Create the project: npm create cloudflare@latest -- my-bot, choose a Worker template.
  3. Write the handler. A minimal one that answers every text message:
export default {
  async fetch(request, env, ctx) {
    if (request.method !== "POST") return new Response("ok");
    if (request.headers.get("X-Telegram-Bot-Api-Secret-Token") !== env.WEBHOOK_SECRET) {
      return new Response("forbidden", { status: 403 });
    }
    const update = await request.json();
    const msg = update.message;
    if (msg && msg.text) {
      ctx.waitUntil(
        fetch(`https://api.telegram.org/bot${env.BOT_TOKEN}/sendMessage`, {
          method: "POST",
          headers: { "content-type": "application/json" },
          body: JSON.stringify({ chat_id: msg.chat.id, text: `You said: ${msg.text}` }),
        })
      );
    }
    return new Response("ok");
  },
};
  1. Run it locally: npx wrangler dev. Telegram cannot reach your computer, so test the handler with a curl POST against the local address and the real thing after the deploy.
  2. Store the secrets: npx wrangler secret put BOT_TOKEN and npx wrangler secret put WEBHOOK_SECRET. Cloudflare's documentation notes that secret values are not visible in Wrangler or the dashboard after you define them.
  3. Deploy: npx wrangler deploy. The Worker appears at <worker>.<subdomain>.workers.dev; on the first deploy Wrangler asks you to set up the subdomain.
  4. Tell Telegram where to send updates:
curl "https://api.telegram.org/bot<TOKEN>/setWebhook" \
  -d "url=https://my-bot.<subdomain>.workers.dev/" \
  -d "secret_token=<the same value as WEBHOOK_SECRET>"
  1. Check: getWebhookInfo should show the URL and an empty last_error_message, and the bot should answer in Telegram.

The handler answers at once and sends the reply with ctx.waitUntil(), which extends the Worker's life to finish work after the response; Cloudflare's documentation says it can run for up to 30 seconds after the response is sent. The requirements Telegram puts on a webhook are in Domain for a Telegram Mini App or bot.

Deploying through the API and with an AI assistant

Wrangler can deploy without a browser login: it reads CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID from the environment, which Cloudflare lists for CI/CD and other automation. That is also how an AI assistant can deploy for you.

  1. Create a dedicated API token in the Cloudflare dashboard from the Edit Cloudflare Workers template. It lists Workers Scripts, Workers KV Storage, Workers Routes and a few read permissions. Remove what you do not need, limit it to one account and set an expiry.
  2. Keep the token in an environment variable on your own machine and give the assistant a project folder, not the token text.
  3. Describe the bot to the assistant. A prompt that works as a starting point:
Create a Cloudflare Worker in JavaScript for a Telegram bot with Wrangler.
It receives webhook updates, checks the X-Telegram-Bot-Api-Secret-Token header
against env.WEBHOOK_SECRET, answers /start and /help, sends replies with the
Bot API via env.BOT_TOKEN, never logs secrets, makes no more than five
subrequests per update and uses no loops. Give wrangler.toml and the commands
to run locally, set secrets and deploy.
  1. Review what it wrote. Check the secret header test, that nothing prints the token, that unknown update types return ok, and that nothing waits in a loop.
  2. Delete the token when the work is finished, or narrow it to read-only.

An assistant with a token can change your Cloudflare account within the permissions of that token, so a narrow separate token matters more than any prompt.

workers.dev or your own domain

  • workers.dev. Cloudflare says the workers.dev subdomain lets you deploy without first onboarding your own domain, and that your URL is public when it is enabled. It is enough for a bot's webhook. Cloudflare recommends running production Workers on a route or a custom domain.
  • A custom domain. To add one you need an active Cloudflare zone and a Worker to invoke, and the hostname must not already have a CNAME record. Buy the domain and connect it with Connect a domain to Cloudflare; the purchase path is in How to buy a domain with crypto.
  • For a Mini App the domain matters. Since 20 July 2026 Telegram ties Mini App methods to the app's original domain, so a name you control is safer than a shared address. The details are in Domain for a Telegram Mini App or bot.

Register a domain in 2 minutes

1,500+ zones, WHOIS privacy on request, crypto payment and DNS management — all inside the Telegram bot.

Open the bot

Where the free plan stops being enough

  • Traffic above 100,000 requests a day. The Paid plan removes the daily request limit; check its current prices on Cloudflare's pricing page.
  • State that changes on every message. KV allows 1,000 writes a day on Free. Keep counters in D1, batch the writes or use a database outside Cloudflare.
  • Work that takes more than 10 ms of CPU time. Image processing, large parsing and encryption of big files belong elsewhere or on the Paid plan.
  • A process that has to stay alive. Userbots and long polling need a VPS or a container.

Common mistakes

  • Running long polling on a Worker. Switch to a webhook; Telegram does not deliver to getUpdates while a webhook is set.
  • Skipping the secret_token. Without the header check anyone who finds the URL can send fake updates.
  • Writing to KV on every message and hitting 1,000 writes a day by lunch.
  • The bot token in the source code. Use wrangler secret put.
  • Giving an AI assistant the Global API Key instead of a narrow token.
  • Handling only message updates. Button presses arrive as callback_query, edits as edited_message; answer every type with a 200.
  • Forgetting the limit resets at midnight UTC, not at your midnight.

Checklist

  1. Make the bot in BotFather and keep the token private.
  2. Create the Worker project and write the handler with the secret header check.
  3. Put the token and the secret in wrangler secret put.
  4. Deploy with npx wrangler deploy.
  5. Set the webhook with secret_token and check getWebhookInfo.
  6. If an AI assistant helps, give it a dedicated narrow token and delete it afterwards.
  7. Watch the daily request count and the KV writes.

Cloudflare's free plan is a real, small server for a Telegram bot: enough for commands, notifications and a few scheduled jobs, with clear walls at 100,000 requests a day, 10 ms of CPU time and 1,000 KV writes. Knowing where those walls are is what keeps the bot alive when it grows.

FAQ

Can I host a Telegram bot on Cloudflare for free?

Yes, if the bot works through a webhook. The Workers Free plan allows 100,000 requests a day with no charge for duration, and every update Telegram sends is one request. The code runs per request, so the bot is not a process that stays alive.

How many users can a free Worker serve?

The limit is requests, not users: 100,000 a day, which is about one request per second on average, and the counter resets at midnight UTC. A bot that gets tens of thousands of messages a day fits; a bot with a constant stream above that needs the Paid plan.

Can a Worker run a bot on long polling?

It is not a good fit. Long polling needs a process that keeps asking Telegram for updates, while a Worker runs only when a request or a cron trigger arrives. Use a webhook instead; Telegram stops delivering to getUpdates while a webhook is set.

Do I need my own domain?

Not for a bot: a workers.dev address works as the webhook URL. A custom domain needs the domain to be an active zone on Cloudflare, and it is worth it for a Mini App, where the domain becomes part of the app's identity.

Is it safe to give an AI assistant a Cloudflare API token?

Only a narrow one: create a separate token from the Edit Cloudflare Workers template, limit it to one account, set an expiry, keep it in an environment variable on your own machine and delete it when the work is done. Never hand over the Global API Key.

Register a domain in 2 minutes

1,500+ zones, WHOIS privacy on request, crypto payment and DNS management — all inside the Telegram bot.

Open the bot