Run one polling worker per token
Choose Node.js polling bot under Telegram bot hosting for a grammY bot that calls bot.start() or a Telegraf bot that calls bot.launch() without webhook options. The worker asks Telegram for new messages over an outbound connection. You can close your laptop after the hosted bot is running.
Save the token from BotFather in Variables as TELEGRAM_BOT_TOKEN. Stop the copy on your computer before starting the hosted one. If you previously registered an HTTPS webhook, follow the webhook-to-polling migration guide to keep pending updates.
A /ping handler for grammY
For a new project, run npm init -y and npm install grammy locally. Save this as index.mjs. The command name in the handler is ping. In Telegram you type it with the slash.
import { Bot } from 'grammy';
const bot = new Bot(process.env.TELEGRAM_BOT_TOKEN);
bot.command('ping', ctx => ctx.reply('pong from grammY'));
bot.start();The same command in Telegraf
If your project uses Telegraf, install telegraf as a production dependency with npm install telegraf. Use this version of index.mjs for the test.
import { Telegraf } from 'telegraf';
const bot = new Telegraf(process.env.TELEGRAM_BOT_TOKEN);
bot.command('ping', ctx => ctx.reply('pong from Telegraf'));
bot.launch();Check which process replies
Upload index.mjs, package.json and package-lock.json to the deployment root. Set MAIN_FILE to index.mjs and start the worker. Open a private chat with the bot username from BotFather and send /ping. The reply should name the library you deployed. Restart the worker and repeat with your laptop copy still stopped.
A Telegram 409 Conflict mentioning another getUpdates request points to a second poller using that token. Look for a local development process or the previous host. For a project that already handles incoming HTTP requests, use the Node.js webhook profile and HTTPS setup.