Everything about running a bot on Telegram with the harness — the setup, and the handful of non-obvious platform gotchas that will otherwise cost you an afternoon. Most of these aren’t seeyourai quirks; they’re Telegram Bot API + BotFather behavior that nothing warns you about.
/newbot → copy the token.
seeyourai bot config <bot> set TELEGRAM_BOT_TOKEN=123456:ABC...
Enable the channel in the bot’s launch command (BOT_CMD in its .env):
--channels plugin:telegram@claude-plugins-official. If the bot also loads
bot-mesh or another development channel, put Telegram in that flag instead (see
BOT-MESH.md).
⚠️ Install the plugin first — it is NOT bundled. On a fresh machine no plugins are installed, and
--channels plugin:telegram@…then silently no-ops: the bot launches,--remote-controlworks, but nothing polls Telegram, so DMs are never received (andseeyourai bot access <bot> listshows no pending code no matter how many times you message it). Install once per machine, then confirm:claude plugin install telegram@claude-plugins-official claude plugin list # -> telegram@claude-plugins-official ... enabled
seeyourai admin enroll # prints a code to DM to the bot
seeyourai bot run <bot>.seeyourai bot access <bot> pair a1b2c3
seeyourai bot access <bot> policy allowlist
Each bot runs its Telegram channel isolated — its own token and its own
TELEGRAM_STATE_DIR (~/.seeyourai/channels/<bot>/telegram), so pairing state,
allowlist, and inbox never collide between bots.
⚠️ The stock /telegram:access skill hardcodes the global
~/.claude/channels/telegram path and ignores TELEGRAM_STATE_DIR, so it can’t
approve a pairing for an isolated bot. Always use seeyourai bot access <bot> —
it targets the right per-bot access.json.
seeyourai bot access <bot> list # policy, allowlist, pending, groups
seeyourai bot access <bot> pair <code> # approve a DM pairing
seeyourai bot access <bot> policy allowlist # pairing | allowlist | disabled
The harness has its own line to the person running the bots. It calls the Telegram
HTTP API itself, with no agent or plugin involved, so it works when the bot is the
broken part. It carries the “back online” message a SessionStart hook sends on
every launch (the hook lives in a gitignored .claude/settings.local.json), and the
alerts: crash loops, failing pushes, a bot stuck on a prompt, undelivered mail.
It goes to one Telegram user id, TELEGRAM_ADMIN_CHAT_ID in
~/.seeyourai/config, which every bot inherits. seeyourai admin enroll sets it
by having you DM a code to the bot and sends a test message; seeyourai admin show
says who gets alerts. A group id is refused, so an alert never lands in a group. With
no id set, nothing is sent and the log says so. A bot with no token of its own
borrows the token of another bot on the same machine, and the message still names
the bot it is about; OPERATOR_TRANSPORT_BOT in the same file picks which.
TELEGRAM_CHAT_ID is something else: the bot’s own conversation chat.
$TELEGRAM_STATE_DIR/.env — outbound doesn’tThe single most confusing Telegram failure: the bot sends its “back online” ping and any replies fine, but never receives your messages. It looks online; it’s deaf.
The reason is that the two directions use different credentials paths:
notify) calls the Bot API sendMessage
directly using TELEGRAM_BOT_TOKEN from the agent’s environment. Works as soon
as the token is set.server.ts reads the token from
$TELEGRAM_STATE_DIR/.env and, if it isn’t there, exit(1)s. When that
happens the plugin still registers its tools (so the session looks like it
has Telegram), but the getUpdates poller never starts — no bot.pid is
written and nothing is ever received.The harness provisions this file for you. On every launch, for any bot whose
BOT_CMD uses the telegram channel and has a TELEGRAM_BOT_TOKEN, the watchdog
writes $TELEGRAM_STATE_DIR/.env (mode 0600) containing the token (and
TELEGRAM_CHAT_ID). You don’t need to create it by hand.
Diagnosing a bot that pings but doesn’t hear you:
# Is the poller alive? A live PID here means it's consuming getUpdates.
cat "$TELEGRAM_STATE_DIR/bot.pid" # e.g. ~/.seeyourai/channels/<bot>/telegram/bot.pid
# Is the token file present?
ls -l "$TELEGRAM_STATE_DIR/.env"
# Is there a telegram plugin subprocess under the agent?
pgrep -af "plugins/cache/claude-plugins-official/telegram"
No bot.pid / no plugin subprocess ⇒ the poller exited, almost always because
$TELEGRAM_STATE_DIR/.env was missing.
Some Claude Code tools render a choice widget in the Claude Code app’s own UI — e.g. the tool that asks “which of these should I do?” with clickable options. That UI is local to the app; it never gets forwarded through a channel plugin. A user driving the bot purely through Telegram just sees the session go quiet, with no way to answer — from their side it looks hung, not like it’s waiting on them.
For example: mid-task, Claude asks the user to pick between a few options via the picker tool while the user is only ever talking to the bot over Telegram. The session stalls from the user’s point of view until they ask, over Telegram, what is going on.
Fix: when the current turn came in from a Telegram message, ask decisions as a plain text question in a normal reply — list the options inline (e.g. “A) first option B) second option C) third option — which one?”) — and treat the next inbound Telegram message as the answer, instead of calling an interactive-picker tool. This generalizes to any Claude-Code-app-only affordance: if it’s a UI element rather than a chat message, a Telegram-only user can’t see or answer it.
A channel is broadcast / one-way: a bot there must be an admin and there’s no real back-and-forth. For a bot you actually chat with, make a group. (Tell them apart: a channel’s composer says “Broadcast” and it has “subscribers.”)
t.me/+… invite links are for human accounts; a bot can’t join through one. A
member/admin must add it: group title → Add Members → search the bot’s
@username.
-100 prefixThe Bot API chat_id isn’t always what the web URL shows:
| Chat type | web.telegram.org URL | Bot API chat_id |
|---|---|---|
| Basic group | #-1234567890 |
-1234567890 |
| Supergroup / channel | #-1234567890 |
-100 + 1234567890 = -1001234567890 |
A wrong-prefix (or not-a-member) send returns 400 chat not found — that error
means wrong id or not a member, not a permissions problem.
A bot can’t even post to a chat that isn’t in its allowlist. Add the group to
the bot’s access.json under groups:
"groups": { "-1234567890": { "requireMention": false, "allowFrom": [] } }
The poller re-reads access.json on every inbound — no restart needed. seeyourai bot access
does not edit groups; edit the json directly.
BotFather enables privacy mode by default. A privacy-ON bot in a group receives
only messages that @mention it, replies to its own messages, and /commands —
never plain chatter. This is the #1 reason a correctly-added, correctly-
allowlisted bot still says nothing.
Check it from the bot’s own token (no poller conflict):
curl -s "https://api.telegram.org/bot<TOKEN>/getMe" | grep -o '"can_read_all_group_messages":[a-z]*'
# false → privacy ON (mentions/replies/commands only)
# true → privacy OFF (sees all group messages)
Fix: @BotFather → /setprivacy → pick the bot →
Disable → then remove and re-add the bot to the group (the change only
applies to groups it joins after the toggle).
Telegram never delivers a bot’s messages to another bot — in DMs or groups. So two bots can’t drive each other (e.g. “take turns counting” won’t work on its own): the second bot never sees the first’s message. A back-and-forth needs a human, or one orchestrator relaying between them.
You can introspect a lot without touching the running poller:
getMe → username, and can_read_all_group_messages (privacy mode).getChat / getChatMember → is the bot a member? what’s the chat title?TOKEN=$(seeyourai bot config <bot> get TELEGRAM_BOT_TOKEN)
curl -s "https://api.telegram.org/bot$TOKEN/getMe"
curl -s "https://api.telegram.org/bot$TOKEN/getChatMember?chat_id=<group>&user_id=<botId>"
Avoid getUpdates while the bot is running — that’s what the live poller
long-polls, and a second reader will fight it.
access.json shapeUnder each bot’s TELEGRAM_STATE_DIR:
{
"dmPolicy": "pairing", // pairing | allowlist | disabled
"allowFrom": ["1234567890"], // approved DM user ids
"groups": { "-100…": { "requireMention": false, "allowFrom": [] } },
"pending": {} // codes awaiting `access pair`
}