Environment variables (env)
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 must listen on if it runs an HTTP server |
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.