Create a bot via @BotFather
- Open Telegram and search for @BotFather.
- Send
/newbotand follow the prompts (choose a name and username for your bot). - Copy the bot token BotFather gives you — it looks like
123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11.
Get your Telegram user ID
- Search for @userinfobot on Telegram.
- Send it any message.
- It replies with your numeric user ID (for example,
123456789).
Max uses your user ID to lock the bot to you exclusively. Without it, anyone who discovers your bot’s username could send it commands.
Run max setup
Run the interactive wizard and enter the token and user ID when prompted:Alternatively, edit
~/.max/.env directly:Disable group joins (recommended)
Prevent your bot from being added to group chats:
- Go back to @BotFather.
- Send
/mybotsand select your bot. - Open Bot Settings → Allow Groups?
- Set to Disable.
AUTHORIZED_USER_ID.Available bot commands
| Command | What it does |
|---|---|
/cancel | Cancel the current in-flight message |
/model | Show the current model |
/model <name> | Switch to a different model |
/auto | Toggle automatic model routing on or off |
/memory | List stored memories |
/skills | List installed skills |
/workers | List active worker sessions |
/restart | Restart the Max daemon |
/help | Show the full command list |
Security model
Max’s Telegram integration is locked to a single authorized user ID. The auth check happens at the grammy middleware layer — messages from any other Telegram user ID are silently dropped before they reach the orchestrator. There is no way to escalate access by adding the bot to a group or sending commands from a different account. The bot token and authorized user ID are stored in~/.max/.env on your local machine and are never sent anywhere beyond Telegram’s API.
Troubleshooting
Bot doesn't respond at all
Bot doesn't respond at all
- Confirm Max is running:
max tuishould connect successfully. - Check that
TELEGRAM_BOT_TOKENandAUTHORIZED_USER_IDare set in~/.max/.env. - Run
max setupto re-enter the token if you’re unsure it’s correct. - Make sure the user ID in
.envmatches the number @userinfobot returned for your account.
Error code 401 in logs
Error code 401 in logs
The bot token is invalid or has been revoked. Go to @BotFather, generate a new token for your bot, and update
TELEGRAM_BOT_TOKEN in ~/.max/.env or re-run max setup.Error code 409 in logs
Error code 409 in logs
Another instance of Max is already running with the same token. Run
pkill -f 'max start' to stop any stale processes, then start Max again.Messages from Telegram are ignored
Messages from Telegram are ignored
The message is probably being dropped by the auth middleware. Confirm that the number in
AUTHORIZED_USER_ID exactly matches the ID @userinfobot gave you — they must be identical. There is no partial match or fallback.Long responses are cut off
Long responses are cut off
Telegram has a 4,096 character per-message limit. Max automatically chunks long responses into multiple messages, so a very long reply will arrive as a sequence of messages rather than one block.