/tgapi/ that transparently forwards requests to api.telegram.org and captures outgoing messages. It also intercepts several management methods so your backend can use the standard Telegram Bot API without conflicting with BotMux’s internal state.
Why use the API proxy?
Telegram’sgetUpdates only returns incoming messages — messages sent by the bot itself are not included. The API proxy solves this by intercepting send methods and saving the sent message to the database.
Setup
Change your backend’s API base URL:File download proxy
BotMux also provides a file download endpoint that makes it compatible as a drop-inbase_file_url for Telegram bot libraries:
Local Bot API Server upstream
BotMux can use a self-hosted Telegram Bot API Server as upstream instead ofapi.telegram.org:
--local mode, getFile may return absolute filesystem paths. BotMux handles this in two ways:
- Via
/tgapi/—getFileresponses rewrite absolutefile_pathvalues to BotMux-relative paths, so backends can keep usingbase_file_url=http://botmux:8080/tgapi. - Direct filesystem reads — if BotMux shares a volume with the Local Bot API server, point it at the files directory:
-tg-api-files, /api/media and /tgapi/file/ can serve files directly from disk when colocated, avoiding redundant HTTP downloads. Large uploads (up to ~2 GB) and longer timeouts are enabled automatically when a custom -tg-api is set.
Captured methods
The API Proxy URL is displayed in the bot detail view when proxy mode is enabled (click to copy).
Intercepted methods
The following Telegram Bot API methods are intercepted by the proxy and handled internally by BotMux instead of being forwarded to Telegram:When
BOTMUX_ALLOW_AUTO_REGISTER=1 is set, the setWebhook interception enables zero-configuration migration: point your existing bot backend at BotMux’s API proxy URL, and BotMux will automatically register the bot and start forwarding updates to your backend.