Run a Telegram bot
Run a Telegram bot
Section titled “Run a Telegram bot”Outcome: Gormes long-polls Telegram for DMs from an allowlisted chat, runs the same kernel + tool loop as the TUI, and persists turns to the local SQLite memory store.
Prerequisites: A working
gormes chat -q(see first turn). A bot token from @BotFather. The numeric chat ID you want the bot to answer.
-
Store the bot token in
~/.gormes/.envTerminal window gormes config set GORMES_TELEGRAM_TOKEN '123456:ABC-DEF...'*_TOKENkeys are written to.env, notconfig.toml.TELEGRAM_BOT_TOKENis also accepted. -
Set the allowed chat id in
config.tomlTerminal window gormes config set telegram.allowed_chat_id 123456789Replace
123456789with your numeric chat or group id. Without an allowlist (ortelegram.first_run_discovery = true), the adapter refuses to start. -
Verify config
Terminal window gormes config showThe
telegramsection should list the allowed chat id; secrets stay redacted. -
Start the Telegram adapter
Terminal window gormes telegramThe process long-polls Telegram and routes messages from the allowed chat through the configured agent.
Verify
Section titled “Verify”In your Telegram chat, send a message to the bot. It should reply with a model-generated response. Then:
gormes session listA new session row appears for the channel turn. Persisted turns survive a process restart.
Troubleshooting
Section titled “Troubleshooting”no Telegram bot token→GORMES_TELEGRAM_TOKEN,TELEGRAM_BOT_TOKEN, or[telegram].bot_tokenis unset.no chat/user allowlist and discovery disabled→ Settelegram.allowed_chat_id,TELEGRAM_ALLOWED_USERS, or temporarilytelegram.first_run_discovery = true.telegram_polling_conflict→ Another process is polling this bot token. Stop it before startinggormes telegram.- Visible Markdown markers or duplicate tool progress in chat → Capture the channel output and the input that produced it; this is a UX parity bug, not a misconfiguration.
See also
Section titled “See also”- Run a multi-channel gateway — same kernel, multiple channels.
- Route channels to different agents
- Provider setup