FabricFabric
Messaging

Telegram

Connect Telegram to Fabric Agents — create a bot with @BotFather, paste the token, and drive sessions from any chat with the bot.

Telegram uses the official Bot API. You create a bot through Telegram's @BotFather, paste the token into Fabric Agents, and every DM to your bot drives a session.

1. Create a bot

  1. Open Telegram and message @BotFather.

  2. Send /newbot.

  3. Pick a display name (what shows up in chats) and a username (must end in bot, e.g. my_fabric_bot).

  4. BotFather replies with a token that looks like:

    123456789:AAH...long-string...xyz
  5. Copy that token. Don't share it — it's the full credential for the bot.

Optional but recommended — still chatting with BotFather:

  • /setdescription — shown in the bot's profile.

  • /setuserpic — upload an avatar.

  • /setcommands — preload the slash commands Fabric Agents supports, so Telegram auto-completes them:

    new - Create a new session and bind this chat
    bind - Pick from recent sessions
    pair - Redeem a 6-digit pairing code
    status - Show the session bound to this chat
    stop - Abort the current agent run
    unbind - Disconnect this chat from its session
    help - List available commands

2. Connect Telegram in Fabric Agents

  1. Open Fabric Agents → Settings → Messaging.
  2. Click Connect on the Telegram row.
  3. Paste the token.
  4. Click Test connection — you should see a green check and your bot's username.
  5. Click Save.

The token is stored in your OS keychain. Telegram now shows as connected and is listening for messages.

3. Start a session from your phone

Open Telegram, search for the bot's username (the one ending in bot), and send:

/help

The bot replies with the command list. Then:

/new my first agent

A new session appears in your workspace sidebar. Every subsequent message you send in that Telegram chat flows into the agent; replies come back in the chat.

4. Attachments

Telegram supports sending files to the agent. The bot accepts any of:

TypeMax sizeDelivered to the agent as
Photo20 MBImage attachment on the next turn
Document20 MBFile attachment (raw bytes + filename)
Voice note20 MBAudio file the agent can transcribe via its own tools
Video20 MBVideo file
Audio20 MBAudio file

Caption text sent with an attachment is treated as the user's message for that turn.

5. Response modes

Default is progress — one evolving message per run. Change it in Settings → Messaging → ⋯ on the binding row → Response mode.

See Messaging overview — response modes for details.

6. Adding the bot to a group

Telegram bots can be added to groups, but Fabric Agents is tuned for DMs — only direct messages currently drive sessions. Group messages are ignored.

Reconfigure or disconnect

  • ReconfigureSettings → Messaging → ⋯ on Telegram row → Reconfigure. Paste a new token (e.g. after you rotate via /revoke in BotFather).
  • Disconnect — same menu → Disconnect. The bot stops polling; bindings are preserved, so reconnecting later resumes them.

Troubleshooting

"Not a valid bot" — the token is wrong or the bot was deleted. Re-issue with /token in BotFather or create a fresh bot.

Messages aren't reaching the agent — check Settings → Messaging. The Telegram row should show "Connected as @yourbot". If it shows "Disconnected", click Connect and test again.

Bot stops responding after a while — Telegram revokes tokens if another poller connects with the same token. Make sure you're not running two Fabric Agents instances (or any other bot framework) with the same token.

Auto-reconnect after failures — when Telegram polling stops for any reason (most commonly a 409 Conflict from a second instance grabbing the same token), Fabric Agents now schedules a reconnect with exponential backoff: 30s for 409 (so the competing process has time to exit), 5s for other errors, capped at 5 minutes. You don't need to click Connect manually — the gateway tries on its own and resumes routing as soon as Telegram accepts polling again. If reconnect keeps failing, the messaging-gateway.log records a warn line (adapter_not_connected) the moment the gateway drops a session event, so the underlying outage isn't silent.

On this page