Environment Variables
Store secrets and config values in your bot environment and read them with process.env.
Every bot has its own isolated environment. Store API keys, tokens, and config values there and read them with process.env — they never appear in your bot code.
How it works
Each bot has a private .env file managed by the platform. When your bot runs, those values are loaded into a sandboxed process.env scoped only to your bot. Other bots cannot see your variables, and you cannot read host-level system variables.
Setting variables
Open the Env Editor from the bot editor toolbar. Add one variable per line in KEY=VALUE format. Lines starting with # are treated as comments and ignored.
Reading in bot code
Use process.env.KEY_NAME anywhere in your bot code. The value is always a string — parse it if you need a number or boolean.
Built-in variables
Two variables are always available without being set in the Env Editor:
| Variable | Value |
|---|---|
process.env.BOT_TOKEN | The Telegram bot token connected to this bot. |
process.env.BOT_ID | The internal NxCreator bot ID for this bot. |
BOT_TOKEN and BOT_ID are injected automatically. You do not need to set them in the Env Editor.Security model
- Scoped: Your bot can only read its own variables — not the host system's environment and not another bot's variables.
- Read-only: Bot code cannot modify or delete env values at runtime. Changes only take effect through the Env Editor.
Common patterns
Guard against missing variables
Use in custom webhook handlers
Env vars are available inside logic[...] handlers the same way as in regular bot code — useful for validating a shared secret on incoming webhook calls.