Overview
Telegram tool allows you to send messages, photos, and documents via Telegram bots. The user asks to send or read messages; the agent calls Telegram and returns the outcome.Installation
Environment Variables
Quick Start
Usage with Agent
Available Methods
send_message(chat_id, text)
Send a text message.send_photo(chat_id, photo_url, caption=None)
Send a photo.Common Errors
| Error | Cause | Solution |
|---|---|---|
TELEGRAM_BOT_TOKEN not configured | Missing token | Set environment variable |
chat not found | Invalid chat ID | Check chat ID |
bot was blocked | User blocked bot | User must unblock |
Error: API quota exceeded. Check billing. | OpenAI 429 insufficient_quota | Add credits at platform.openai.com |
Error: Rate limit exceeded. Try again later. | OpenAI / provider rate limit | Wait and retry, or upgrade plan |
Error: Authentication failed. Check API key. | Invalid / missing API key | Verify OPENAI_API_KEY env var |
Error: Request timeout. Try again. | Slow LLM / network | Retry; check connectivity |
How It Works
Best Practices
Store the bot token securely
Store the bot token securely
Read the Telegram bot token from the environment, never hard-code it.
Validate chat IDs
Validate chat IDs
Confirm the target chat ID before sending so messages reach the right conversation.
Handle rate limits
Handle rate limits
Telegram throttles bursts. Retry with backoff so the agent stays responsive.
Related Tools
Slack
Slack messaging
Discord
Discord messaging
WhatsApp messaging

