docs/guides/telegram-ai-agent.md
This guide connects one Telegram bot to nanobot. Messages sent to that bot use your normal nanobot model, tools, memory, and workspace.
telegram channel enabled in nanobotnanobot agent -m "Hello!"
@BotFather.python -m pip install nanobot-ai
nanobot onboard --wizard
Start the WebUI:
nanobot webui
Open Settings → Channels → Telegram:
http://127.0.0.1:7890.The configuration badge appears as soon as a bot token is saved. A connection check is separate: if Telegram is temporarily unreachable, the saved configuration remains valid and the bot can continue working in environments where the gateway has network access.
Saved tokens and proxy URLs are masked. A proxy entered here is used both for the connection check and for normal Telegram traffic.
For a headless installation, install Telegram support:
nanobot plugins enable telegram
Then merge this snippet into ~/.nanobot/config.json:
{
"channels": {
"telegram": {
"enabled": true,
"token": "YOUR_BOT_TOKEN",
"proxy": "http://127.0.0.1:7890"
}
}
}
Omit proxy when the gateway can reach Telegram directly.
Omitting allowFrom enables pairing-only mode. The first DM from a new user
gets a pairing code instead of agent access.
Telegram uses long polling by default. Webhook mode is available for public HTTPS deployments; start with long polling for the first test.
nanobot channels status
nanobot gateway
Leave the gateway running while you test messages.
Open Telegram, DM the bot, and send:
Hello from Telegram
The bot should reply with a pairing code. Approve it from an already trusted surface, such as the local CLI:
nanobot agent -m "/pairing approve ABCD-EFGH"
Send the message again after approval. The reply should use the same model and workspace as your local CLI check.
allowFrom only when you want a
static allowlist instead of code approval.allowFrom: ["*"] unless the bot is isolated or intentionally public.nanobot plugins enable telegram again in
the same Python environment.api.telegram.org,
or open Advanced → Network proxy and enter a proxy.nanobot gateway --verbose and confirm the
Telegram channel is enabled.richMessages disabled.