Example bots¶
Three small bots that deploy on BotBarn without changes, the recommended webhook bot first. Each one answers /start and echoes every
text message. Upload the archive on the bot's Source tab, add the token, and deploy.
| Example | Language and library | Updates | Built from | Download |
|---|---|---|---|---|
| python-webhook | Python 3.14, python-telegram-bot 22 | Webhook, polling when webhooks are off | Generated Containerfile | python-webhook.zip |
| python-polling | Python 3.14, python-telegram-bot 22 | Long polling | Generated Containerfile | python-polling.zip |
| node-polling | Node.js 22, grammY | Long polling | Its own Containerfile | node-polling.zip |
python-webhook¶
In webhook mode (BOTBARN_WEBHOOK_MANAGED=1) it listens on 0.0.0.0:$PORT and refuses requests
without the secret; BotBarn registers the webhook, so the code never calls setWebhook. In polling
mode it uses long polling. Start here: webhooks are the recommended mode on BotBarn. See
Polling or webhook.
python-polling¶
The smallest bot: reads TELEGRAM_BOT_TOKEN, registers /start and an echo handler, and starts long
polling with a 30-second timeout. Use it when webhooks do not fit your bot, and switch the bot to
Polling on its Telegram updates card if your AI assistant created it (bots created in the web app
already start in polling mode).
node-polling¶
Shows a bot in another language with its own Containerfile. Long polling with grammY's default
30-second timeout; stops cleanly on SIGTERM. Keep the bot in Polling mode (the default for bots created in the web app).
Run an example on your computer¶
unzip python-polling.zip -d python-polling && cd python-polling
pip install -r requirements.txt
TELEGRAM_BOT_TOKEN=<your token> python main.py
Stop it before you deploy on BotBarn: a token can poll from one place at a time.