Skip to content

strands-telegram-listener

Community Contribution

This is a community-maintained package that is not owned or supported by the Strands team. Validate and review the package before using it in your project.

Have your own integration? We'd love to add it here too!

strands-telegram-listener is a real-time Telegram message processing tool with AI-powered auto-replies and comprehensive event handling.

Installation

pip install strands-telegram-listener

Usage

from strands import Agent
from strands_telegram_listener import telegram_listener

agent = Agent(tools=[telegram_listener])

# Start listening for messages
agent("start Telegram listener")

# Get recent messages
agent("get last 10 Telegram messages")

# Check listener status
agent("check Telegram listener status")

Key Features

  • Real-time Processing: Long polling for instant message handling
  • AI Auto-replies: Intelligent responses using Strands agents
  • Event Storage: Comprehensive message history in JSONL format
  • Smart Filtering: Message deduplication and selective processing
  • Background Threading: Non-blocking operation
  • Status Monitoring: Real-time listener status and metrics
  • Flexible Configuration: Environment-based settings

Configuration

TELEGRAM_BOT_TOKEN=your_bot_token         # Required
STRANDS_TELEGRAM_AUTO_REPLY=true          # Optional
STRANDS_TELEGRAM_LISTEN_ONLY_TAG=#support # Optional

Get your bot token at: BotFather

Resources