Skip to content
API Blog

Telegram

Lobu’s Telegram adapter supports direct messages, group chats, and interactive workflows. Under the hood, Lobu uses the Chat SDK Telegram adapter to handle DMs and group messaging.

  1. Open @BotFather in Telegram and send /newbot.
  2. Pick a name and a username for the bot, then copy the bot token BotFather returns (format <digits>:<35+ char alphanumeric>).
  3. Store the token as TELEGRAM_BOT_TOKEN in your project .env and reference it with secret("TELEGRAM_BOT_TOKEN") (or let the config’s botToken fall back to the env var).
  4. To let the bot see all group messages instead of just commands, message BotFather with /setprivacy and disable privacy mode.
  5. Use Agents → Connections in the web app to add Telegram, or declare a telegram connection in lobu.config.ts.

To skip the bot-token setup entirely, declare a telegram connection with credentialMode: "hosted" to use the hosted Lobu bot: lobu run prints a /lobu link <code> you redeem by DMing the hosted bot.

FieldRequiredTypeDescription
botTokenNostringTelegram bot token from BotFather (format '<digits>:<35+ char alphanumeric>'). Falls back to TELEGRAM_BOT_TOKEN env var.
modeNoauto | webhook | pollingRuntime mode: auto (default), webhook, or polling.
secretTokenNostringWebhook secret token for x-telegram-bot-api-secret-token verification.
userNameNostringOverride bot username.
apiBaseUrlNostringCustom Telegram API base URL.
  • Direct messages and group chat mentions trigger the agent.
  • Streaming responses with throttled message edits.
  • Markdown formatting — agent responses render as Telegram-flavored markdown.
  • Interactive elements — inline buttons for user prompts, permission grants, and configuration.
  • Access control — restrict which users or groups can interact with the agent.
  • Webhook or long-pollingmode selects the runtime transport (auto picks one for you).
  • Personal assistant in a one-on-one Telegram DM.
  • Team assistant in a Telegram group (engineering, support, knowledge base).
  • Notification bot that pushes agent output to a channel or group.