Logo
Features

Telegram

How the Telegram integration works -- setting up a bot, conversations, and supported features.

Telegram

Telegram is currently the only messaging channel in BabyClaw. The integration is built on grammY and supports text messages, photos, streaming replies, slash commands, and inline approval buttons.

Creating a bot

  1. Open Telegram and message @BotFather
  2. Send /newbot
  3. Choose a name (displayed in chats) and a username (must end in bot)
  4. BotFather gives you a token -- copy it

Add the token to your config:

{
  "channels": {
    "telegram": {
      "botToken": "123456789:ABCdefGHIjklMNOpqrsTUVwxyz"
    }
  }
}

Start the gateway and message your bot. That's it.

How conversations work

Each Telegram chat (or topic within a forum-style group) creates a separate session in BabyClaw. The agent maintains independent context for each session, so conversations in different chats don't bleed into each other.

The first chat you message the bot from becomes the main session. The main session is special -- it's the only one where cross-chat messaging tools and long-term memory extraction are active.

Reply chains

If you reply to one of the bot's messages, BabyClaw links your reply to the original session context. This is useful in groups where multiple conversations might be happening.

You can also enable "reply-chain" mode in the config, which scopes sessions by reply thread rather than just by chat:

{
  "session": {
    "replyChainMode": "reply-chain"
  }
}

Supported message types

Inbound (you to the bot):

  • Text messages
  • Photos (processed with the vision model if configured)
  • Replies to bot messages

Outbound (bot to you):

  • Text with Telegram MarkdownV2 formatting
  • Images
  • Files (documents, audio, video, animations)
  • Typing indicators while the agent is thinking

Streaming replies

When the agent generates a response, BabyClaw streams it to Telegram as a draft message that gets updated as new text arrives. You'll see the message being "typed" in real-time rather than waiting for the full response.

If the agent is using tools (running a shell command, searching the web, etc.), you'll see a brief status update while it works.

Slash commands

The Telegram bot responds to a few built-in commands:

CommandWhat it does
/link <alias>Link this chat with an alias so the agent can send messages to it
/unlinkUnlink this chat
/schedulesList active schedules for this chat
/heartbeatShow heartbeat status (enabled, next run time)

Linking chats

Chat linking lets the agent send messages across different Telegram chats. To link a group chat:

  1. Add your bot to the group
  2. Send /link my-group (the alias is a short name you pick)
  3. Now the agent can target my-group when sending scheduled messages or cross-chat messages

Aliases must be lowercase alphanumeric with hyphens, like work-chat or family.

Shell command approval

When the agent tries to run a shell command that isn't in the allowlist, BabyClaw can send you an inline keyboard button to approve or deny it (instead of just blocking it). This gives you control without having to add every possible command to the allowlist upfront.

Sending "stop"

If the agent is in the middle of a long response or running tools, send stop to cancel the current turn. The agent will stop what it's doing and wait for your next message.