Setup Guide
Step 1: Create Telegram Bot
- Open Telegram and message @BotFather
- Send
/newbot - Choose a name for your bot
- Choose a username (must end in
bot) - Copy the bot token (format:
123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11)
Step 2: Get LLM API Key
Anthropic (Recommended)
- Go to https://console.anthropic.com
- Create account / sign in
- Go to API Keys
- Create new key
OpenAI
- Go to https://platform.openai.com
- Create account / sign in
- Go to API Keys
- Create new key
Step 3: Deploy to Render
Option A: One-Click Deploy
- Fork this repo to your GitHub
- Log in to Render
- New → Background Worker
- Connect your forked repo
- Render will auto-detect
render.yaml - Add environment variables:
TELEGRAM_BOT_TOKEN- Your bot tokenANTHROPIC_API_KEY- Your API key
- Create Service
Option B: Manual Setup
- Create new Background Worker on Render
- Connect GitHub repo
- Settings:
- Runtime: Docker
- Dockerfile:
./Dockerfile
- Add environment variables as above
- Add 10GB disk mount at
/data - Deploy
Step 4: Connect Telegram
After deployment:
- In Render logs, look for the pairing code
- Open Telegram and find your bot
- Send
/start - The bot will show connection status
Step 5: Using the Bot
Basic Chat
Just send any message to the bot.
Commands
/start- Show help/new- Start fresh session/stop- Abort current response/status- Show bot status
Media Support
- Send photos → Bot analyzes them
- Send documents → Bot reads them
- Send voice → Bot processes them
Troubleshooting
Bot not responding
- Check Render logs for errors
- Verify bot token is correct
- Ensure API key is valid
Session errors
- Check
/datadisk is mounted - Verify disk has space
Rate limiting
- Pi handles this automatically
- Responses may be delayed during high load
Local Development
# Clone repo
git clone https://github.com/yourusername/pi-telegram-247.git
cd pi-telegram-247
# Setup
./scripts/setup.sh
# Configure
cp .env.example .env
# Edit .env with your keys
# Run
./scripts/run.sh
Architecture Notes
- Pi runs in RPC mode (headless)
- Telegram extension handles bot connection
- Sessions persist in
/data/pi-sessions/ - Config stored in
/data/pi-config/ - Long polling (no webhooks needed)
Cost Estimate
- Render Starter: ~$7/month
- Pi API usage: Depends on usage
- Claude Sonnet 4: ~$3/M input, $15/M output
- Typical usage: $5-20/month
Xet Storage Details
- Size:
- 2.58 kB
- Xet hash:
- 3a25905705760060995401b019671e24a84d0a11ed783af61efc93d473a1f3b3
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.