Skip to Content
TemplatesTelegram Chat Bot

Telegram Chat Bot

Deploy an AI-powered chat bot that responds on Telegram. The cage hibernates when no one is chatting and wakes automatically when a message arrives (~30-40 seconds cold start).

Prerequisites

  • A LobsterCage account (sign up )
  • The lobster CLI installed (npm install -g lobstercage-cli)
  • An AI provider API key (Anthropic, OpenAI, etc.)
  • A Telegram bot token (from @BotFather )

Quick setup

lobster create chatbot lobster ssh chatbot openclaw configure

The openclaw configure wizard walks you through:

  • Choosing your AI provider and entering your API key
  • Entering your Telegram bot token
  • Registering the webhook URL with Telegram

OpenClaw is pre-installed in every cage — no installation needed.

Register the webhook

Get your cage’s webhook URL:

lobster status chatbot

The output includes a Webhook URL like:

https://gateway.lobstercage.ai/hook/cage_abc123/tok_xyz/

For Telegram, OpenClaw can register this automatically during openclaw configure. You can also register it manually:

curl -X POST "https://api.telegram.org/bot${BOT_TOKEN}/setWebhook" \ -d '{"url": "YOUR_WEBHOOK_URL"}'

Test it

Send a message to your bot on Telegram. You should get a response within a few seconds (or ~30-40 seconds if the cage was hibernated).

OpenClaw auto-starts on every wake from hibernation — no startup scripts needed. Once you’ve run openclaw configure, the cage manager detects your config and launches OpenClaw automatically.

Programmatic setup

For creating chatbots programmatically (e.g., from an orchestrator), use the openclaw-chatbot template with env vars:

lobster create chatbot --template openclaw-chatbot lobster env set chatbot ANTHROPIC_API_KEY=sk-ant-... lobster env set chatbot TELEGRAM_BOT_TOKEN=123456:ABC...

The openclaw-chatbot template tells the cage manager to auto-detect the Telegram bot token from env vars and generate the OpenClaw config at boot. All secrets are encrypted at rest with AES-256.

Cost comparison

SetupMonthly cost (light use)Monthly cost (heavy use)
LobsterCage Starter~$2 (~8 hrs active)$99 (always-on)
AWS EC2 t3.medium (always-on)~$30~$30
Railway / Render~$5-7~$20+

LobsterCage pricing at $0.004/credit, Starter cage = 60 credits/hr ($0.24/hr). For bots that need to run 24/7, an always-on cage at $99/mo is cheaper than per-minute billing.

The key difference: LobsterCage cages hibernate when idle. A bot that handles a few conversations per day might run for 10-20 minutes total — costing pennies instead of a flat monthly fee.

Last updated on