The Telegram Bot API Docker container is configured entirely through environment variables. The entrypoint script parses these variables and passes the appropriate flags to the underlyingDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/ragnarok22/telegram-bot-api-docker/llms.txt
Use this file to discover all available pages before exploring further.
telegram-bot-api binary.
Required Variables
These variables must be set for the container to start:Your Telegram API ID obtained from my.telegram.org.The container will exit with an error if this is not set.
Your Telegram API hash obtained from my.telegram.org.The container will exit with an error if this is not set.
Optional Variables
These variables have sensible defaults and can be overridden as needed:The HTTP port where the Bot API server listens for incoming requests.Corresponds to the
--http-port flag.Remember to update your Docker port mapping when changing this value:
The HTTP port for the statistics endpoint.Corresponds to the
--http-stat-port flag.The server working directory where bot data is stored.Corresponds to the
--dir flag.Each bot’s data is stored in a subdirectory named by its user ID within this directory.
Directory for storing HTTP server temporary files.Corresponds to the
--temp-dir flag.Path to the log file where the server writes its logs.Corresponds to the
--log flag.Enable local mode to allow the Bot API server to serve local requests and return absolute file paths.Corresponds to the
--local flag.Accepts 1 or true (case-insensitive) to enable:Additional command-line arguments passed directly to the Common options include:
telegram-bot-api binary.Use this for advanced configuration options not covered by the dedicated environment variables.--max-webhook-connections: Maximum number of webhook connections--log-verbosity-level: Control log verbosity (0-1023)--max-connections: Maximum number of simultaneous connections
Complete Example
Here’s a complete.env file with all variables:
How It Works
Theentrypoint.sh script (source at entrypoint.sh:9-70) validates required variables, applies defaults for optional ones, and constructs the command-line arguments:
- Checks that
TELEGRAM_API_IDandTELEGRAM_API_HASHare set - Builds the argument string with defaults for unset variables
- Processes the
TELEGRAM_LOCALflag (accepts1ortrue) - Appends
TELEGRAM_EXTRA_ARGSverbatim to the end - Executes
telegram-bot-apiwith the constructed arguments
Validation Errors
If required variables are missing, the container will exit immediately with a clear error:.env file or Docker run command to ensure these are properly set.