Salta ai contenuti
← Torna al sito
Soleri | Docs

Telegram Integration

Questi contenuti non sono ancora disponibili nella tua lingua.

Your agent can run as a Telegram bot, giving you a mobile-friendly interface to your knowledge base, planning, and all agent capabilities. The Telegram transport runs alongside the standard MCP interface — you can use both.

From your agent project directory:

Terminal window
npx @soleri/cli telegram enable

This generates four files in your agent’s src/ directory:

FilePurpose
telegram-bot.tsBot entry point and message handling
telegram-agent.tsAgent integration layer
telegram-config.tsConfiguration loading
telegram-supervisor.tsProcess supervisor with auto-restart

It also adds the grammy dependency to your package.json and registers two npm scripts:

  • npm run telegram:start — production mode
  • npm run telegram:dev — development mode with auto-restart (via tsx)

After enabling, run the interactive setup:

Terminal window
npx @soleri/cli telegram setup

The wizard walks you through four steps:

  1. Open Telegram and talk to @BotFather
  2. Send /newbot and follow the instructions
  3. Copy the bot token when you receive it
  4. Paste it into the wizard

Choose your provider:

  • Anthropic (Claude) — recommended
  • OpenAI — GPT-4.1, GPT-4.1-mini, or o3
  • Environment variable — skip if you set ANTHROPIC_API_KEY or OPENAI_API_KEY in your environment

Optionally set a passphrase. When set, users must send the passphrase to authenticate before the bot responds to their messages. Leave empty for open access.

Pick a default model. For Anthropic: Claude Sonnet 4 (fast, recommended), Claude Opus 4 (powerful), or Claude 3.5 Haiku (economical). For OpenAI: GPT-4.1, GPT-4.1-mini, or o3.

The wizard saves configuration to ~/.{agent-id}/telegram.json.

Terminal window
npm run telegram:start # Production
npm run telegram:dev # Development (auto-restart on changes)
Terminal window
npx @soleri/cli telegram status

This shows:

  • Whether all Telegram source files are present
  • Grammy dependency status
  • npm script registration
  • Configuration file location and contents (token set, API key set, model)
  • Overall readiness and next steps
Terminal window
npx @soleri/cli telegram disable

This removes the four Telegram source files, the grammy dependency, and the telegram npm scripts from package.json. Run npm install afterward to clean up node_modules.

Once running, you can monitor the bot:

Terminal window
tail -f ~/.{agent-id}/logs/telegram-*.log # Bot logs
tail -f ~/.{agent-id}/logs/events-*.jsonl # Event stream

Replace {agent-id} with your agent’s ID.


Previous: Getting Started — install and scaffold your first agent. Next: Customizing Your Agent — shape your agent’s personality, domains, and behavior. See also Transports for other connection methods and the CLI Reference for all soleri telegram subcommands.