Environment variables (env)
Updated:
Environment variables are settings your bot reads at startup: the token, a channel ID, the list of admins, and so on. Instead of hard-coding them, your code reads them — so changing the token never requires rewriting the code.
Variables provided by the platform
You cannot change these — Botxona sets them automatically:
| Variable | Meaning |
|---|---|
BOT_TOKEN | Your bot's Telegram token |
TELEGRAM_API_URL | The platform proxy address. Optional — you don't have to use it: even if the bot calls the default api.telegram.org, requests are automatically routed through the proxy |
DATA_DIR | The only place where persistent data is kept |
TZ | Time zone (Asia/Tashkent) |
PORT | The port your bot's HTTP server must listen on in webhook mode (0.0.0.0:), 8080 by default |
WEBHOOK_PATH | The path that receives webhook requests, /webhook by default |
WEBHOOK_URL | The address to pass to setWebhook: https://webhook.botxona.internal + WEBHOOK_PATH (the host is ignored) |
WEBHOOK_DOMAIN | webhook.botxona.internal — for libraries that want the domain separately |
WEBHOOK_SECRET | The secret token to pass to setWebhook as secret_token |
UPDATE_DELIVERY | The update mode: auto, polling or webhook |
BOTXONA_EXTRA_TOKENS | Only when "Extra tokens" were added in the dashboard: the tokens of the other Telegram bots this bot operates, comma-separated. Each token gets its own updates (getUpdates or its own setWebhook). It may be absent — code must handle that |
More on the webhook variables: Webhook or long polling. Bots that use polling can ignore them.
Variables you add yourself
Settings specific to your bot's logic — for example ADMIN_IDS, CHANNEL_ID, WORK_HOURS. Document them in your code in a .env.example file (no values, just the name and a comment):
# Admin Telegram IDs, comma-separated
ADMIN_IDS=
# Working hours, e.g. 09:00-18:00
WORK_HOURS=09:00-18:00
When the bot is uploaded, the system reads this file and shows an input field for each variable under Settings → Environment variables in the dashboard. You enter the values there — they are stored encrypted and are never shown again after saving (only a "set" badge is visible); entering a new value replaces the old one.
Once a value is entered or changed, the bot restarts automatically — no need to upload the code again.
What if there is no .env.example?
The bot still starts, but the check report shows a yellow mark along with a list of variables used in the code but not documented — you can add those manually in the dashboard too.
Secrets never go into the ZIP
Even if a .env file (with real values) ends up in the archive, the system deletes it automatically for security. Only .env.example (a template without values) is useful and safe.
Next step
How each variable is checked: 6 rules — rule 6. Where to store data: Data and backups.